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