Question about saving SVG

Hello,
I have a question about saving SVG.
When I try to save the workbook as SVG I always get a strange file format but not SVG.
What I have do to get SVG as XML format?
grafik.png (92.1 KB)

Here is my code:

var workBook = new Workbook();
workBook.Worksheets[0].Cells[“A1”].Value = “DEMOTEXT”;
workBook.Save(@“C:\Users\MBerthold\Downloads\Demo.svg”);

Thank you for your support.

@moosbart,

Please share your sample file for our testing. We will reproduce the problem and provide our feedback after analysis.

@moosbart,

You cannot render the whole workbook to SVG file format. For your information, a workbook might have more than one pages and we do not think multi-pages can be rendered into one SVG file. You can render whole workbook with multi-pages to one tiff image. Alternatively, please individually render worksheet page(s) to SVG file format for your needs.

Hope, this helps a bit.

OK thanks
But why will the SVG format be offered for saving?
If I only save a worksheet, no SVG will come out.
Only when I work with the class “SheetRender” I get a useful result. Is not there a better way here.

var opts = new ImageOrPrintOptions()
{
SaveFormat = Aspose.Cells.SaveFormat.SVG,
SVGFitToViewPort = true,
OnePagePerSheet = true,
};
var sr = new SheetRender(worksheet, opts);
sr.ToImage(0, svgPath);

So I researched again now.
And I noticed the following behavior.
When I save a worksheet as SVG, it does not save an SVG but a Tiff.
If I call the SVG in Tiff this will be done correctly.
Here is the code:

var workBook = new Workbook();
workBook.Worksheets[0].Cells[“A1”].Value = “DEMOTEXT”;
workBook.Save(@“C:\Users\MBerthold\Downloads\Demo.svg”, SaveFormat.SVG);

Result file: Demo.zip (8.0 KB)

The problem is the render of Tiff instead of SVG used as the format.
My current Aspose Cells version is: 18.9.0

P.S. According to W3C standard, an SVG can also contain several pages.
https://www.w3.org/TR/2004/WD-SVG12-20041027/multipage.html

@moosbart,

We were able to observe the issue but we need to look into it more. We have logged the issue in our database for investigation and for a fix. Once, we will have some news for you, we will update you in this topic.

This issue has been logged as

CELLSNET-46396 - Workbook saved as SVG is corrupted as it is actually TIFF file

Regarding creating a multiple page SVG, i.e. converting complete workbook to SVG is also recorded in this ticket and we will discuss this matter as well on its turn.

@moosbart,

We did evaluate your issue/requirements further.
According to Multipage - Inkscape Wiki, it seems that SVG multipage feature will be dropped in the coming SVG 2.0. And, SVG 1.2 is still a draft according to Scalable Vector Graphics (SVG) Full 1.2 Specification
Also, it seems that Chrome browser cannot display the demo multipage svg files in the link Multiple pages (SVG 1.2)

So, we will not support to render workbook/worksheet to single one multipage svg file.

Hi,
thank you for you feedback.
The problem with the SVG as TIFF format is still fixed or?

Thank you for your support.

@moosbart,

You should not save the whole workbook to render to SVG file format at the first place. We suggest to use SheetRender/WorkbookRender to render worksheet/workbook to image in TIFF file format. In case you need to save the different worksheet pages as SVG files, you can use SheetRender API with relevant ImageOrPrintOptions options (e.g SaveFormat to be set to SVG format) for rendering.

Hi,
thanks for the solution.
The suggestion of you is an emergency solution.
What needs to be customized is the enum of the class “ImageOrPrintOptions”.
This may not be SVG on Tiff but SVG and it would come out right.
These are SVG SaveOptions and not Tiff SaveOptions.
Here is the screenshot.
grafik.png (53.2 KB)

I hope you can follow me.

Thank you for your support.

@moosbart

We have recorded your feedback and we will fix this problem, you will get a SVG image of first page of the active sheet via API Workbook.Save. Once, we will have some further news for you, we will update you in this topic.

@moosbart,

Please try our latest version/fix:
Aspose.Cells18.10.1 For .Net2_AuthenticodeSigned.Zip
Aspose.Cells18.10.1 For .Net4.0.Zip

Your issue should be fixed in it as you will get a SVG image of the first page of the active sheet via the API Workbook.Save to save to SVG.

Let us know your feedback

Hi,
I tested it and it works.
Good Job :slight_smile:

thanks for your support.

@moosbart,

Good to know your issue is sorted out by the new fix/version. Feel free to contact us any time if you need further help or have some other issue or queries, we will be happy to assist you soon.

The issues you have found earlier (filed as CELLSNET-46396) have been fixed in Aspose.Cells for .NET v18.11. This message was posted using BugNotificationTool from Downloads module by Amjad_Sahi