Difference between HTML and SVG

Dear Aspose,
when exporting worksheet into HTML and SVG there is a significant difference.

Image describing difference:
Please see for SVG how text does not fit properly in table.
JapanInTable-Html-SVG-Difference.png (91.4 KB)

and also zip file containing files for reconstruction and further investigation:
source excel file, Generated HTML, Generated SVG , Image with difference (for brief orientation)
JapanInTable-2023-05-11.zip (168.3 KB)

Generated with Aspose.Cells 23.3 (on Linux)

@ottap,

Thanks for the template Excel file and screenshot.

I noticed the issue you mentioned by rendering your template file to SVG and HTML. I found some differences. We have opened the following new ticket(s) in our internal issue tracking system and will deliver their fixes according to the terms mentioned in Free Support Policies.

Issue ID(s): CELLSNET-53341

You can obtain Paid Support Services if you need support on a priority basis, along with the direct access to our Paid Support management team.

@ottap

While converting to Svg, to make the output match Excel printview, font is checked during the process.
Please make sure that font “MS ゴシック” is installed/avaliable on your environment.

Good day Aspose.
That font mentioned above is (when you translate “MS ゴシック” from Japan) MS Gothic.
When such font is installed on Windows machines results are better than on Linux without the font completely, but still it not looking the same like in excel. Please see the difference on attached image describing different “images” on one line in original file and generated SVGs.

Original-VS-AsposeCellsForWindowsSvg-MSGothicInstalled.png (89.6 KB)

So not sure how Excel knows it (since I did not installed that Japanese font) but the font looks the same even if I switch to MS Gothic - but will differ if I try for example Arial.

So please look at the difference in source file attached to this issue and this image describing that difference that also number of words on line does not match (even if you use same font).

Thanks.

Regards
Pavel OTTA

@ottap

While rendering workbook to Svg, the output matches the Excel printview(or manually save as pdf in Excel): JapanInTable_Excel2016.pdf (81.8 KB)

Hi Aspose,
please can you attach program routine that was used to generate same looking SVG as the PDF for attached Excel file and SVG file which was generated, please.

Please also let me know which font Name are you using to achieve this result (since we were using MS Gothic).

This will help us in using our program in Japan environment.

@ottap

Code:

Workbook wb = new Workbook("JapanInTable.xlsx");

ImageOrPrintOptions imgOpt = new ImageOrPrintOptions();
imgOpt.ImageType = ImageType.Svg;

//render to svg image
SheetRender sr = new SheetRender(wb.Worksheets[0], imgOpt);
sr.ToImage(0, "ouput.svg");

//save to pdf
PdfSaveOptions pdfSaveOptions = new PdfSaveOptions();
wb.Save("output.pdf", pdfSaveOptions);

Generated svg and pdf file: output.zip (79.4 KB)

We also use MS Gothic font. In Windows, the font file path is “C:\Windows\Fonts\msgothic.ttc”.

Good day Aspose,
thanks for the code.

Based on SVG you generated we can see that it does not match EXCEL document (which was sent to you and used for generation of that SVG). Please see one more time the detail:

DifferenceBetweenExcelAndSVG-LeftExcel-RightAsposeSVG.png (84.6 KB)

In Excel (if you open in in MS Excel) you will see on the end of line (marked green character and another character marked in the beginning of another line).

Those two same characters are being displayed in the end of one line in SVG generated in Aspose.

We are using zoom 100% in Excel - Also in Windows is scale set to 100 % (not sure whether this is important for reconstruction) - to see what we have on the image.

Here (on attached image) we are pointing to Text wrap feature which is being performed differently in Excel and Aspose (keeping different number of characters on one line).

Please provide the fix for this behavior (please feel free to use any file uploaded to this issue).

Best regards
Pavel

@ottap,

Thanks for the screenshot and details.

We noticed it. We will evaluate your issue in details and get back to you soon.

@ottap

As described, while rendering workbook to Svg, the output matches the Excel printview(or manually save as pdf in Excel). So please compare Aspose generated svg and Excel saved pdf.
I attach two files for your reference: AsposeSvg_ExcelPdf.zip (101.0 KB)

  1. CELLSNET-53341_Cs.svg is the svg file saved by Aspsoe.Cells 23.5
  2. JapanInTable_Excel2016_Japanese_Language.pdf is the pdf file saved by Microsoft Excel.

You can find that JapanInTable_Excel2016_Japanese_Language.pdf is different with the view you see in Excel Normal view(100% zoom).

However, there are still some difference comparing Aspose.Cells generated svg file CELLSNET-53341_Cs.svg and Excel saved pdf file JapanInTable_Excel2016_Japanese_Language.pdf. We can’t fix it.