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

Free Support Forum - aspose.com

Convert from Excel in .jpg

Hi. When converting Excel in .jpg encountered a problem. The text in italics cells (this is optional) and has ShrinkToFit = True property, but 1 or 2 characters at the end does not fit can not see them. This only occurs if the text is in italics. Please tell me how to fit all the text in the cells? An example is in the attached file. To convert using Aspose.Cells 8.6.1.0 and the following code:

Dim book As New Aspose.Cells.Workbook(APath)
Dim sheet As Aspose.Cells.Worksheet = book.Worksheets(0)
Dim imgOptions As New Aspose.Cells.Rendering.ImageOrPrintOptions()
sheet.PageSetup.Zoom = 140
imgOptions.ImageFormat = System.Drawing.Imaging.ImageFormat.Jpeg
imgOptions.OnePagePerSheet = False
imgOptions.IsImageFitToPage = True
imgOptions.IsCellAutoFit = True
Dim SR As New Aspose.Cells.Rendering.SheetRender(sheet, imgOptions)

Hi Nik,


Thank you for contacting Aspose support.

Please share your input sample spreadsheet so we could test the scenario against the latest version of Aspose.Cells for .NET 8.7.2 or you can do it your self by downloading the latest release from here. In case the problem persists, please provide the sample spreadsheet so we could raise the concerns with the product team.

Unfortunately, the latest version does not help. The attached file is highlighted in yellow are the same cells.

Hi Nik,


Thank you for sharing the sample spreadsheet. Please note, your sample is using the font GOST type B which is probably not present in your environment therefore when you try to render the said spreadsheet with Aspose.Cells for .NET API, it tries to substitute the required font with most suited available font. On my side, the API substituted the aforementioned font with Arial Cyr. You may confirm this by rendering the spreadsheet to PDF format and inspect the embedded fonts in it.

Please note, this is the consequence of the font substitution mechanism that the glyph dimensions are not properly calculated and therefore the text may overflow the cell dimensions. The most appropriate solution is to find the TrueType Font (TTF & TTC files only) and install them in your environment before rendering the spreadsheet. An alternative could be to dynamically change the font for the styles used in the spreadsheet and then render the spreadsheet. Please check the following piece of code for font change.

VB.NET

Dim book As New Aspose.Cells.Workbook(dir & “Example (1).xls”)
For i As Integer = 0 To book.CountOfStylesInPool - 1
book.GetStyleInPool(i).Font.Name = “Arial Unicode
Next i
Dim sheet As Aspose.Cells.Worksheet = book.Worksheets(0)
Dim imgOptions As New Aspose.Cells.Rendering.ImageOrPrintOptions()
sheet.PageSetup.Zoom = 140
imgOptions.ImageFormat = System.Drawing.Imaging.ImageFormat.Jpeg
imgOptions.OnePagePerSheet = False
'imgOptions.IsImageFitToPage = true;
'imgOptions.IsCellAutoFit = true;
Dim options As New Aspose.Cells.AutoFitterOptions()
options.AutoFitMergedCells = True
options.OnlyAuto = True
sheet.AutoFitColumns(options)
Dim SR As New Aspose.Cells.Rendering.SheetRender(sheet, imgOptions)
SR.ToImage(0, dir & “output(font change).jpg”)
book.Save(dir & “output(font change).pdf”)

Unfortunately, the alternative solution isn't producing the expected results therefore I have logged an investigative ticket CELLSNET-44334 to look further into this matter. Please spare us some time to properly analyze the case and revert back with updates in this regard.

This font is available in our environment . But the font is not dependent , as trying to change the font to Arial, Tahoma, Times New Roman - the result is the same. Another tried to remove the italics and bold font to make - the problem remained. From this I can conclude that the length of the text is calculated not quite true when applied to the text properties of the Italic or Bold. This occurs when a cell by 1 or 2 characters more than it can accommodate , without changing the font size . You can check it. As an example, to attach a picture and a red line displayed the border. I hope the problem will be solved soon. Many thanks!

Hi Nik,


Thank you for bringing this up. You are correct as I have tested the scenario by manually changing the font (for all cells) to Arial and then rendered the spreadsheet to image and PDF formats. I can still replicate the said issue therefore I have logged my observations to a separate ticket as CELLSNET-44335 for further investigation & correction.

That said, I request you to please provide us the GOST type B font from your environment so we could test the original scenario by installing the said font on our side.

Tell me, please , how much time must be ( at least approximately) to solve this problem?

Hi Nik,


Thank you for providing the requested font. We have reevaluated the case by installing the GOST type B font in our environment, however, the result is still incorrect. We have recorded these observations to the ticket CELLSNET-44335 for product team’s review. Please note, the said ticket is currently pending for analysis and is in the queue with other priority tasks. We can share the release schedule for the fix as soon as we have completed the preliminary analysis of the said scenario.

That said, please note that we publish maintenance releases containing the minor fixes every week. We are hopeful that the fix for the problem discussed in this thread will be available during the next week. However, the concrete release schedule will be available in a couple of days when we have completed the analysis.

Thank you very much!

Hi,

Thanks for using Aspose.Cells.

This is to inform you that we have fixed your issue CELLSNET-44335 now. We will soon provide the fix after performing QA and including other enhancements and fixes.

Hi Nik,


Please try the latest version of Aspose.Cells for .NET 8.7.2.2 against the problem logged earlier as CELLSNET-44335 and let us know of your feedback.

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


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