Formatting not preserved when converting from �XML Spreadsheet 2003� format to XLSX format


Dear Aspose team,

I am an Aspose.Cells developer, and I think I found an issue with the fidelity of Excel formatting styles when converting from “XML Spreadsheet 2003” format to XLSX format using Aspose.Cells for Java (version 8.5.2). I open the .xml file with Aspose, and then save it as “SaveFormat.XLSX”, and the files look different when opening in Excel 2010.

I investigated and found that the way format inheritance works in “XML Spreadsheet 2003” format is not preserved by the conversion. The XML format defines styles in a hierarchical manner, but when overriding a styling element, attributes that are not defined in the child style are not inherited in Excel, they are reset to the value of the default style instead.

Example (this is valid “XML Spreadsheet 2003” format obtained by “save as” within Excel 2010) :







Note that the Font Size attribute is defined in the parent style, but not in the child style.

For cells with the style “s22”, the size is interpreted by Excel as 10 (the default), not as 14 from the parent style. All attributes not defined in an overriding element see their value reset to default, not inherited. But after conversion with Aspose, the cell with style “s22” will have size 14, so it looks like Aspose used inheritance logic then computing the format internally, and when saving as xlsx the cell obtains the inherited formatting values.

Has anybody reported issue with the support for “XML Spreadsheet 2003” format, and are you aware of this problem ?

Can you reproduce the issue (I can provide some test files in xml format if that helps) ?

Could this behavior be modified in a future version of Aspose.Cells ?

Thanks and regards,

Aspose.Cells User

<!–[if gte mso 9]>
<w:WordDocument>
<w:View>Normal</w:View>
<w:Zoom>0</w:Zoom>
<w:TrackMoves/>
<w:TrackFormatting/>
<w:PunctuationKerning/>
<w:ValidateAgainstSchemas/>
<w:SaveIfXMLInvalid>false</w:SaveIfXMLInvalid>
<w:IgnoreMixedContent>false</w:IgnoreMixedContent>
<w:AlwaysShowPlaceholderText>false</w:AlwaysShowPlaceholderText>
<w:DoNotPromoteQF/>
<w:LidThemeOther>EN-US</w:LidThemeOther>
<w:LidThemeAsian>JA</w:LidThemeAsian>
<w:LidThemeComplexScript>X-NONE</w:LidThemeComplexScript>
<w:Compatibility>
<w:BreakWrappedTables/>
<w:SnapToGridInCell/>
<w:WrapTextWithPunct/>
<w:UseAsianBreakRules/>
<w:DontGrowAutofit/>
<w:SplitPgBreakAndParaMark/>
<w:EnableOpenTypeKerning/>
<w:DontFlipMirrorIndents/>
<w:OverrideTableStyleHps/>
</w:Compatibility>
<m:mathPr>
<m:mathFont m:val=“Cambria Math”/>
<m:brkBin m:val=“before”/>
<m:brkBinSub m:val="–"/>
<m:smallFrac m:val=“off”/>
<m:dispDef/>
<m:lMargin m:val=“0”/>
<m:rMargin m:val=“0”/>
<m:defJc m:val=“centerGroup”/>
<m:wrapIndent m:val=“1440”/>
<m:intLim m:val=“subSup”/>
<m:naryLim m:val=“undOvr”/>
</m:mathPr></w:WordDocument>
<![endif]–><!–[if gte mso 10]>

/* Style Definitions */ table.MsoNormalTable {mso-style-name:"Table Normal"; mso-tstyle-rowband-size:0; mso-tstyle-colband-size:0; mso-style-noshow:yes; mso-style-priority:99; mso-style-parent:""; mso-padding-alt:0cm 5.4pt 0cm 5.4pt; mso-para-margin:0cm; mso-para-margin-bottom:.0001pt; mso-pagination:widow-orphan; font-size:10.0pt; font-family:"Times New Roman","serif";}

<![endif]–>

Hi,


Thank you for contacting Aspose support, and sharing the detailed problem description. However, it would be of great help in investigating the said issue on our side if you can share a sample for our testing. If found to be an problem in the API, we will surely fix it with future releases. By the way, we haven’t received such issue recently so before you move forward to provide us the above requested, we strongly suggest you to try the case against the latest version of Aspose.Cells for Java (Latest Version).

Thank you very much for your quick reply !

Here is an example of a simple xml file content : this can be opened in Excel, and after conversion to xlsx with Aspose the documents look different to me (size in cell B1 is different) :

#### start of file content below this (must be saved in a utf-8 .xml file) ####
<?xml version="1.0"?>
<?mso-application progid="Excel.Sheet"?>
<Workbook xmlns=“urn:schemas-microsoft-com:office:spreadsheet”
xmlns:o=“urn:schemas-microsoft-com:office:office”
xmlns:x=“urn:schemas-microsoft-com:office:excel”
xmlns:ss=“urn:schemas-microsoft-com:office:spreadsheet”
xmlns:html=“HTML 4.01 Specification”>

Aspose.Cell test case








































単価 Price@
市場 Market






#### end of file content above this ####

I converted the file with code that looks like this :
public static void main(String[] args) throws Exception {

InputStream is = <we get an input stream of our original file in “XML Spreadsheet 2003” format >
Workbook wb = new Workbook(is);
wb.save(outputFile, SaveFormat.XLSX);
System.out.println(“Conversion Complete”);
}
<!–[if gte mso 9]>
<w:WordDocument>
<w:View>Normal</w:View>
<w:Zoom>0</w:Zoom>
<w:TrackMoves/>
<w:TrackFormatting/>
<w:PunctuationKerning/>
<w:ValidateAgainstSchemas/>
<w:SaveIfXMLInvalid>false</w:SaveIfXMLInvalid>
<w:IgnoreMixedContent>false</w:IgnoreMixedContent>
<w:AlwaysShowPlaceholderText>false</w:AlwaysShowPlaceholderText>
<w:DoNotPromoteQF/>
<w:LidThemeOther>EN-US</w:LidThemeOther>
<w:LidThemeAsian>JA</w:LidThemeAsian>
<w:LidThemeComplexScript>X-NONE</w:LidThemeComplexScript>
<w:Compatibility>
<w:BreakWrappedTables/>
<w:SnapToGridInCell/>
<w:WrapTextWithPunct/>
<w:UseAsianBreakRules/>
<w:DontGrowAutofit/>
<w:SplitPgBreakAndParaMark/>
<w:EnableOpenTypeKerning/>
<w:DontFlipMirrorIndents/>
<w:OverrideTableStyleHps/>
</w:Compatibility>
<m:mathPr>
<m:mathFont m:val=“Cambria Math”/>
<m:brkBin m:val=“before”/>
<m:brkBinSub m:val=“–”/>
<m:smallFrac m:val=“off”/>
<m:dispDef/>
<m:lMargin m:val=“0”/>
<m:rMargin m:val=“0”/>
<m:defJc m:val=“centerGroup”/>
<m:wrapIndent m:val=“1440”/>
<m:intLim m:val=“subSup”/>
<m:naryLim m:val=“undOvr”/>
</m:mathPr></w:WordDocument>
<![endif]–><!–[if gte mso 10]>

/* Style Definitions */ table.MsoNormalTable {mso-style-name:"Table Normal"; mso-tstyle-rowband-size:0; mso-tstyle-colband-size:0; mso-style-noshow:yes; mso-style-priority:99; mso-style-parent:""; mso-padding-alt:0cm 5.4pt 0cm 5.4pt; mso-para-margin:0cm; mso-para-margin-bottom:.0001pt; mso-pagination:widow-orphan; font-size:10.0pt; font-family:"Times New Roman","serif";}

<![endif]–>

I will try again with the latest version of Aspose next week and report back.

Thank you so much for your help !

Hi,


Thank you for sharing the sample.

I have executed the conversion process on my side while using the latest version of Aspose.Cells for Java 8.6.0.7, and I’m able to see the problem. The size of the text in cell B1 has increased from 10 to 11 in resultant XLSX. Please allow me to check this case further then I will log it for product team’s review, providing the tracking number here for your future reference.

Hi again,


This is to update you that I have further checked the case by converting the XML to different spreadsheet formats (XLS, XLSM, XLSB, XLTX) and found the same issue therefore I have logged a generic ticket with Id CELLSJAVA-41541 for the product team’s review. We will investigate the matter while keeping you updated on the status of correction. We apologize for your inconvenience.

Hi,


This is to inform you that we have fixed the problem logged earlier as CELLSJAVA-41541. We will shortly provide the fix here after ensuring the quality and incorporating other enhancements. As soon as the next build of Aspose.Cells for Java is available for your testing, we will notify you in reference to the aforementioned ticket.

Hi,

this is great to hear, thank you so much for working so quickly on this issue ! I look forward to try the updated version when it is ready.

Thanks and regards,

Aspose.Cells User

(Note : I added a new test case file that I used myself, with more various combinations of styles, it might be useful to try that one as well. This new file is not generated by “save as” with excel though - I wrote it myself)

Hi,


Thank you for sharing another sample. We (support) can test the new sample once we get our hands on the next build of Aspose.Cells for Java so it would be appropriate if you can send out a reminder once we post the upgraded version of the API or you can test it on your side and let us know of your feedback.

Please note, we are expecting the next build to be uploaded within the current week. As soon as it is available for your testing, we will notify you here along with the download link for your reference.

The issues you have found earlier (filed as CELLSJAVA-41541) have been fixed in this update.


This message was posted using Notification2Forum from Downloads module by Aspose Notifier.

Thank you very much for providing an update so quickly ! I should be able to test it using my use cases today - I will report back on the results.

Thanks and regards,

Aspose.Cells User

Hi,


Sure, please feel free to test the new build and let us know of your feedback.

Dear Aspose team,

I tried the new version 8.6.1.0 of the Aspose.Cells library, but all the documents I generated have been the same as with version 8.5.2 that I was using previously.

Especially, the small test file that I first provided still yields different font sizes when opened in Excel 2010 after converting the file with Aspose.

Have you managed to generate an xlsx file that looks the same as the xml file when opened in Excel ?

Best regards,

Aspose User.

Hi,


Thank you for your feedback.

We have retested the scenario while using the latest version of Aspose.Cells for Java 8.6.1 and your sample Aspose_format_conversion_test_extended_01_utf8.xml. We are able to observe the issue for the cell A7. Please check the attached snapshots for the view of both input & output files in Excel 2013. Based on our observations we have re-opened the previously logged ticket CELLSJAVA-41541 and have requested the product team to reevaluate the scenario to provide the justification for this behavior. As soon as we get the updates in this regard, we will post here for your kind reference.

We apologize for the inconvenience caused.

Dear Aspose team,

thank you very much for working on this issue.

Can you provide an approximation of the time that would be necessary to fix this issue ?

Best regards,

Aspose.Cells User.

Hi,


Thank you for writing back.

We have requested the concerned member of the product team to share an insight of the problem, and preferably an estimated time for the fix. As soon as we get some news, we will post here for your reference.

Hi,


We have a good news for you. We have fixed your issue logged earlier as “CELLSJAVA-41541”. We will provide a fix once we perform QA and incorporate other enhancements and fixes.

As soon as the fix is available for public use, we will provide it to you immediately.

Keep in touch.

Thank you.

Thank you very much for this update.

Do you have an estimate about when the fix will become available ?

Thanks and regards,

Aspose.Cells User.

Hi,


As Amjad mentioned, the ticket CELLSJAVA-41541 has been marker resolved. We are just waiting for the product team to share the next build of Aspose.Cells for Java. I believe it will be available by tomorrow (Friday, 6th November, 2015) or early next week. As soon as the next release is available for your testing, we will notify you here in reference to aforementioned tracking number.

Hello,


I was wondering if the build with the fix for ticket CELLSJAVA-41541 has been released and is available yet?

Regards,
Aspose.Cells User

Hi,

Thanks for your posting and using Aspose.Cells.

Please give a try to latest version: Aspose.Cells for Java (Latest Version) and see if it fixes your issue. Let us know your feedback.