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

Free Support Forum - aspose.com

SVG saved via SheetRenderer.toImage varies between stream and file

I have a spreadsheet that I’m trying to render to SVG. The first sheet has an image and a text shape on it. If I use the method SheetRenderer.toImage(pg, fileName), I get the SVG for the entire sheet, including the image and text shape. If I use the method SheetRenderer.toImage(pg, stream), I only get the content of the cells. The image and text shape SVG data is missing. Here’s a short snipet of the code:

Aspose.Cells.Worksheet sheet = doc.Worksheets[withPageId - 1];

ImageOrPrintOptions opts = new ImageOrPrintOptions();
opts.SaveFormat = Aspose.Cells.SaveFormat.SVG;
opts.OnePagePerSheet = true;
opts.SVGFitToViewPort = true;

SheetRender sr = new SheetRender(sheet, opts);

// output to file. all content is there
sr.ToImage(0, “C:\temp\output.svg”);

// output to stream. image and text shape data is not included
MemoryStream mStm = new MemoryStream();
sr.ToImage(0, mStm);

Note that the SVG document returned by the stream method is well formed. That is, its not cut off. Its a valid document with an end tag.

I’m using the stream version of the method to return the SVG content to a web client. Any idea how I can fix this?


Thanks for your posting and using Aspose.Cells.

Please download and try the latest version:
Aspose.Cells for .NET v8.8.0.2 and see if it makes any difference and resolves your issue.

If your issue still occurs, then please provide us your source excel file (i.e. spreadsheet) which you are using in your sample code so that we could test this issue at our end and help you asap.