Get unique Image Name in Excel

Posted by: jonigk on 6 May 2020, 12:44 am EST

    • Post Options:
    • Link

    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

  • Posted 6 May 2020, 6:06 pm EST

    Hello,

    I have escalated the issue to our development team(SPNET-6622) and will inform you once I get any information from them.

    Thanks,

    Mohit

  • Posted 2 August 2020, 5:52 pm EST

    Hello,

    are there any new information on this case yet?

    thanks,

    Sven

  • Posted 4 August 2020, 3:35 am EST

    Hello,

    This will be fixed in the next version of Spread i.e Spread 13.2.

    Thanks,

    Mohit

Need extra support?

Upgrade your support plan and get personal unlimited phone support with our customer engagement team

Learn More

Forum Channels