Posted 6 May 2020, 12:44 am EST - Updated 3 October 2022, 2:43 pm EST
Hey,
is there any way to set the image names(name.png)
Project.zip
Contains a little project with same code.
Load xml / safe to Excel
Content.zip
xml / Excel Files
My problem ist, that all Images after export got the same Name(Name.png), but for future use i need a unique name.
(test.xls Content.zip)
It Seems the the image is not anymore in the cell, after export.
Set Images:
public void Tab_BeforeFormat(TabBeforeFormatParams paramObj)
{
DataTable data = this.GetDataSource("FOTO");
SheetView tab = paramObj.Tab;
int zeile = 0;
foreach (DataRow row in data)
{
Image image = byteArrayToImage((byte[])row["media"]);
if (image != null)
{
FarPoint.Win.Spread.CellType.ImageCellType celltypeImage = new FarPoint.Win.Spread.CellType.ImageCellType();
celltypeImage.Style = FarPoint.Win.RenderStyle.StretchAndScale;
tab.Cells[zeile,0].Value = image;
tab.Cells[zeile,0].CellType = celltypeImage;
tab.Rows[zeile].Height = 60;
}
zeile++;
}
}
public Image byteArrayToImage(byte[] byteArrayIn)
{
Image returnImage = null;
try
{
MemoryStream ms = new MemoryStream(byteArrayIn,0,byteArrayIn.Length);
ms.Write(byteArrayIn, 0, byteArrayIn.Length);
returnImage = Image.FromStream(ms,true);
}
catch
{
returnImage = null;
}
return returnImage;
}
Project.zipContent.zip[img]https://gccontent.blob.core.windows.net/forum-uploads/file-502aa304-9693-4131-9264-52dfeb8dd6b3.png[/img]Content.zipProject.zip[img]https://gccontent.blob.core.windows.net/forum-uploads/file-efb03fa8-445c-4469-8234-f6a6bd67a3ea.png[/img]Content.zipProject.zip