We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Insert image using by smart marker

Hello! I try to insert image value into cell, marked as usual (&=[Table1].Pic). But after processing template with smart markers cell with picture value has Type.ToString() value. Is it possible insert image into excel file using smart marker? I use Aspose.Cells v2.0.50727.


This message was posted using Page2Forum from Smart Markers - Aspose.Cells for .NET

Hi,

Thanks for the query. An issue has been logged into our Issue Tracking System as 18102 for provision of the image support for data processing through Smart Markers. This thread has been linked with the said issue.

You will be automatically notified on provision of this feature.

Kind Regards

<span style=“font-size: 11pt; font-family: “Arial”,“sans-serif”;”>Hi,

Well, we need to add a new smart option to know whether the smart marker is a picture smart marker.

The smart markers should be as:<span style=“font-size: 11pt; font-family: “Arial”,“sans-serif”;”><o:p></o:p>

1) [Table1].Pic(Picture:FitToCell): The smart marker is a picture smart marker and the size of the image should be the same as of the cell.

2) [Table1].Pic(Picture:ScaleXXX) : The smart marker is a picture smart marker and the size of the image should be XXX (it must be a number value) percentage of the original size.


Does it fit your need?

But the image must be left-top aligned, do you want to set Shape.Left and Shape.Top property?

Thanks for your understanding and feedback!


I’m interesting in set width and height in cell and row number in picture marker([Table1].Pic(Picture:Width=5;Height=5). Also it’s useful to pass scale parameter.

Hi,

Please try the attached 5.0.0.5 version. We have supported Smart Marker’s picture option now. There are two ways to scale the picture:
1) Picture:ScaleXXX where XXX represents the height and width scale both
2) Picture.ScaleXXX&YYYwhere XXX is width scale and YYY is height scale

Try the following code with the attached designer XLS:

byte[] imageData = File.ReadAllBytes(@“D:\asp.jpg”);
DataTable t = new DataTable(“Table1”);
DataColumn dc = t.Columns.Add(“Picture”);

dc.DataType = typeof(object);
DataRow row = t.NewRow();
row[0] = imageData;
t.Rows.Add(row);
imageData = File.ReadAllBytes(@“d:\asp1.jpg”);
row = t.NewRow();
row[0] = imageData;
t.Rows.Add(row);
WorkbookDesigner designer = new WorkbookDesigner();
designer.Workbook.Open(@“d:\cells500\SmartBook1.xls”);
designer.SetDataSource(t);
designer.Process();
designer.Workbook.Save(@“d:\cells500\SmartBookOutPut.xls”);

We will look into your mentioned setting width and height. As “;” is used to split the different smart marker option, we plan to add Picture:Left:Value1&Top:Value2&Width:Value3&Height:Value4. The value should be numeric and the unit like 1pt,1.0cm,2.0px,0.5inch. The left and top property should be the offset to the top left corner of the cell. Will it fit to your requirement?

Hi,

We have supported to set height and width as smart marker options with the new fix 5.0.0.7 (attached).

Please try the following codes with the attached sample file:

byte[] imageData = File.ReadAllBytes(@“F:\FileTemp\1.jpg”);

DataTable t = new DataTable(“Table1”);

DataColumn dc = t.Columns.Add(“Picture”);



dc.DataType = typeof(object);

DataRow row = t.NewRow();

row[0] = imageData;

t.Rows.Add(row);

imageData = File.ReadAllBytes(@“F:\FileTemp\aspose.cells-for-.net-logo.jpg”);

row = t.NewRow();

row[0] = imageData;

t.Rows.Add(row);



WorkbookDesigner designer = new WorkbookDesigner();

designer.Workbook.Open(@“F:\FileTemp\SmartBook1.xls”);

designer.SetDataSource(t);

designer.Process();

designer.Workbook.Save(@“F:\FileTemp\dest.xls”);

Thank you.