Problem due to Yield formula while converting excel to PDF

Hi,


And, regarding your logged issue “CELLSJAVA-40665”, well, it is a complicated issue and we are still working on it trying to solve it.

Once we have any update on it, we will let you know here.

Thank you.

Hi Amjad,
Thanks for the fix. “Negative Yield” issue is resolved now. We are awaiting your response on the issue CELLSJAVA-40665. You’ve already mentioned that its a complicated issue. But please keep us posted on the updates.

Regards,
Nagaraj

Hi,

Thanks for using Aspose.Cells.

We have found and fixed the issue. Please wait for hot fix. We will provide it to you asap.

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


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

Hi,
In the latest fixed jar 7.7.0, we noticed that there is a difference in the default font is changed from Arial to Arial MT, can you let us know if this is part of the jar upgrade and also can you let us know if this can be reset back to ARIAL through some settings.

Regards,
Nagaraj A.

Hi,


Could you try setting the default font to your desired font if it works for your needs, see the sample lines of code:
e.g
Sample code:

PdfSaveOptions option = new PdfSaveOptions();
option.setDefaultFont(“Arial”);
//…
workbook.save(stringPdfFile, option);

Thank you.


Hi Amjad,
<!–[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>X-NONE</w:LidThemeAsian>
<w:LidThemeComplexScript>X-NONE</w:LidThemeComplexScript>
<w:Compatibility>
<w:BreakWrappedTables/>
<w:SnapToGridInCell/>
<w:WrapTextWithPunct/>
<w:UseAsianBreakRules/>
<w:DontGrowAutofit/>
<w:SplitPgBreakAndParaMark/>
<w:DontVertAlignCellWithSp/>
<w:DontBreakConstrainedForcedTables/>
<w:DontVertAlignInTxbx/>
<w:Word11KerningPairs/>
<w:CachedColBalance/>
</w:Compatibility>
<w:BrowserLevel>MicrosoftInternetExplorer4</w:BrowserLevel>
<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]–>

Event after using the default font option, while generating PDF using aspose 7 jar, we noticed that font is getting increased compared to file generated using previous jar, due to which we are facing alignment issues with existing templates that we use for PDF conversion.

Attached is sample for your usage to report it to Aspose team, it contains

  • PDF generated using old jar/new jar and new jar with default font set option (Aspose suggested solution).
  • Sample excel file used
  • Java code used for generation.
/* 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-qformat:yes; mso-style-parent:""; mso-padding-alt:0in 5.4pt 0in 5.4pt; mso-para-margin:0in; mso-para-margin-bottom:.0001pt; mso-pagination:widow-orphan; font-size:10.0pt; font-family:"Times New Roman","serif";}

<![endif]–>
Regards,
Nagaraj A

Hi Nagaraj,

Thanks for using Aspose.Cells for Java.

We were able to notice the difference between your old and new pdf. Please let us know which old aspose.cells jar you are using to generate the old pdf.

I have tried some old versions of Aspose.Cells for Java, but they generated the pdf as your new pdf with no difference.

Hi,


I suspect you might be using a version older than v7.0.0, may be v2.4.x etc. Well, Aspose.Cells renders PDF file based on what is shown in print preview of the sheet when viewing in MS Excel. I have evaluated your issue a bit, I come to know that the PDF produced with the new version(s) is fine and identical to print preview of MS Excel for the sheet, you may confirm this on your end. You may also convert the Excel file to PDF using MS Excel, and found almost identical results as per new version of Aspose.Cells.

Thank you.

Hi Amjad,
Yes we were using version 2.4.2.4 prior to this YIELD issue which we posted in the Forum. Only for this YIELD issue we are upgrading the version from 2.4.2.4 to 7.7.0. We are having nearly 400 templates with us which is already formatted and aligned to work with the version 2.4.2.4. Because of this font issue that we are facing the alignment is getting affected. This will really cause a huge effort our end to correct the alignment. Again if we are upgrading to another jar version in future, again we may face the same issue.

To explain in detail about the font issue, with 2.4.x, the font was reducing to 0.5 from the original which was fitting perfectly in our template. But with 7.7.0 the font is increasing 0.5 from the original text in the excel which is causing this alignment issue. If you can help to make the font behave similar to the previous it will be fine or if you can help to provide us the YIELD & PRICE function related fix on top of version 2.4.2.4 it will be really great. Kindly suggest

Regards,
Nagaraj A

Hi,


Well, I am not sure if we could do something for your requirements. As stated, Aspose.Cells renders PDF file based on what is shown in print preview of the sheet when viewing in MS Excel. The PDF produced with the new version(s) is fine as we think and is almost identical to print preview of MS Excel for the sheet, you may confirm this on your end. You may also convert the Excel file to PDF using MS Excel, and find almost identical results as per new version of Aspose.Cells. Also, our hundreds of clients are using Excel to PDF conversion feature in new versions and they also want and expect the rendering to be identical to print previews of Excel sheets, so it will hurt them if we break the feature which we should not do in any case.

Anyways, I have logged a ticket for investigation with an id “CELLSJAVA-40705” into our database. Our concerned developer will look into it if we could do something for it or provide you some workaround using the latest versions or so.

Once we have any update on it, we will let you know here.

Thank you.

Hi Amjad,
Can you let us know if there is any update for us on the above mentioned “CELLSJAVA-40705” ticket.

Regards,
Nagaraj A

Hi,


I am afraid, there is no update at the moment for your custom oriented issue/needs as I checked the issue status (logged as “CELLSJAVA-40705”) into our database.

Once we have any update on it, we will let you know here.

Thank you.

Hi,
As explained earlier, we saw the difference between 2.4.x jar & 7.7.x jar, so we cannot classify it as custom oriented issue as the behavior is not same across the versions. Please consider our query and help to provide an update on the CELLSJAVA-40705.

Regards,
Nagaraj A

Hi,


Well, custom oriented issue in a sense that we still think that the PDF produced with the new version(s) is fine as it is almost identical to print preview of MS Excel for the sheet(s). Could you confirm this on your end. Also, it is quite possible that in older versions this was an issue with it as we try to follow MS Excel renderer for converting Excel files to PDF format which we should do. Moreover, our hundreds of clients are using Excel to PDF conversion feature in new versions and they also want and expect the rendering to be identical to print previews of Excel sheets, so they might not accept that.

Anyways, I have logged your concerns against your issue id “CELLSJAVA-40705” into our database. Our concerned developer will look into it if we could do something for it or provide you some workaround using the latest versions or so, we will happy to do that.

Thank you.

Hi,

We have studied your issue further. For versions v2.x, we use Java’s logical fonts to measure and render text contents when saving to PDF. So the output fonts and appearance have more differences when comparing with the output of MS Excel. From v7.x versions we use physical fonts to measure and render text contents to make the generated PDF same with what MS Excel generates. We are afraid we cannot use Java’s logical fonts again to make the output to be same with those old versions (in fact the output of old versions was incorrect or not so good/ elegant as compared to one of current versions).

We are doing more investigations for your situation now, maybe we can provide some solution for you to decrease all fonts of those cells content, such as change all fonts size to 95% of the original font size. But please note, because the difference of logic for measurement and rendering, even though we can support to decrease the font size of text content to make the size of the output characters similar to those generated by old versions, the layout and appearance of the generated PDF of the two versions may be different.

Thanks for your understanding!

Hi Amjad,
Please let us know once the patch is ready so that we will try it out and will use it if it solves the observation that we’ve disucssed.

Thanks,
Nagaraj A

Hi,


Well, as explained in my previous post, we might not fix your issue, we have given the logic and reasons involved. Anyways, we will still try to evaluate if we could provide some workaround, also, we cannot make any promise at the moment.

Once we have any update on it, we will let you know here.

Thank you.

Hi,

Please try our latest version/fix: Aspose.Cells for Java v7.7.2

Now we support to render fonts with higher precision (float value of font size). Following code can help you to make those fonts in your template file smaller when generating PDF file. Please try it with our new version V7.7.2 to check whether it can fit your requirement:
e.g.
Sample code:

Workbook wb = ...;

for(int i=wb.getCountOfStylesInPool()-1; i>-1; i--)

{

zoomFont(wb.getStyleInPool(i).getFont());

}

for(int i=wss.getCount()-1; i>-1; i--)

{

sheet = wss.get(i);

ShapeCollection shapes = sheet.getShapes();

for(int j=shapes.getCount()-1; j>-1; j--)

{

Shape shape = shapes.get(j);

if(shape.getText() != null && shape.getText().length() > 0)

{

zoomFont(shape.getFont());

ArrayList rt = shape.getCharacters();

if(rt != null && rt.size() > 0)

{

for(int k=rt.size()-1; k>-1; k--)

{

FontSetting fs = (FontSetting)rt.get(k);

zoomFont(fs.getFont());

}

}

}

}

}

...

private static void zoomFont(Font f)

{

f.setDoubleSize(f.getDoubleSize()*0.95);

}

Thank you.

Hi,

Since the font rendering issue not resolved with recent fix, can
you provide yield function fix over the aspose jar which doesn’t have the
physical font feature.( i.e provide yield function fix in aspose jar with java
font.)



Regards,
Nagaraj A<!–[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-qformat:yes; mso-style-parent:""; mso-padding-alt:0in 5.4pt 0in 5.4pt; mso-para-margin:0in; mso-para-margin-bottom:.0001pt; mso-pagination:widow-orphan; font-size:11.0pt; font-family:"Calibri","sans-serif"; mso-ascii-font-family:Calibri; mso-ascii-theme-font:minor-latin; mso-fareast-font-family:"Times New Roman"; mso-fareast-theme-font:minor-fareast; mso-hansi-font-family:Calibri; mso-hansi-theme-font:minor-latin; mso-bidi-font-family:"Times New Roman"; mso-bidi-theme-font:minor-bidi;}

<![endif]–>