EPPlus help needed - redux
Posted: 28 Jun 2018, 18:19
I've been wrestling with EPPlus.dll as in this thread..
Although I've had some success, I've been struggling with charts and pictures. Chart types are enumerated values, I'm pretty sure, so I thought I would have luck as I did with shapes and borders. But not so far ...
The problem code for images is (more or less) like this in C#, and works perfectly if compiled in VS:
From the developer's page on Shapes, Pictures and Charts.
What I've tried is this, where and :
This error is thrown:
All help and suggestions greatly appreciated.
Regarding charts, I should be able to add one with, but it throws an error saying the interface isn't supported (but eChartType is a public enum). Using , where the enum for "Pie" should be 5, the "interface" error isn't thrown, but instead "the parameter is incorrect".
Again, all help and suggestions greatly appreciated.
Regards,
burque505
Although I've had some success, I've been struggling with charts and pictures. Chart types are enumerated values, I'm pretty sure, so I thought I would have luck as I did with shapes and borders. But not so far ...
The problem code for images is (more or less) like this in C#, and works perfectly if compiled in VS:
Code: Select all
var img = Image.FromFile("image.jpg");
var pic = ws.Drawings.AddPicture(myPicture, img);
shape.SetPosition(3, 0, 3, 0) //Position Row, RowOffsetPixels, Column, ColumnOffsetPixels
What I've tried is this, where
Code: Select all
pck := Clr_CreateObject(asm, "OfficeOpenXml.ExcelPackage")
Code: Select all
ws := pck.Workbook.Worksheets.Add("Image")
Code: Select all
picture := ws.Drawings.AddPicture("Picture", "Speaker.bmp")
Spoiler
I've tried replacing the path "Speaker.bmp" with ImageFromFile("Speaker.bmp"), where that function is (not that it works):
Code: Select all
ImageFromFile(filename)
{
static lib := Clr_LoadLibrary("System.Drawing")
return Clr_CreateObject(drawing, "Image.FromFile", filename)
}
Regarding charts, I should be able to add one with
Code: Select all
chart := ws.Drawings.AddChart("Sample", eChartType.Pie)
Code: Select all
chart := ws.Drawings.AddChart("Sample", 5)
Again, all help and suggestions greatly appreciated.
Regards,
burque505