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

Free Support Forum - aspose.com

How to set the height of the Row- Based on the dynamic content

Hi,

I am New to Aspose, Did some research about setting and getting the height of the Row. I have to save the report as PDF.

GetRowHeight(dynamicRow)

setRowHeight(dynamicRow, height)

My Problem is, My content for the cell (it's a merged cell) changes based on the project, so i cannot set the height in Template, In my initial Template i have assigned one row with 4 columns and the height of 15.0 for it. I made it as a wrapText and autofit rowheight. When we update the cell with the long content the height of the cell is not increasing.

I did some work around and able to increase the height of the row, when it is saved as Excel, but by the time it saved as PDF the height of the row is set to 15, unable to see the full content of that cell.

So i manually wanted to set the height of the row, by getting the height after the cell is updated.

GetRowHeight(Row)

But it returns me 15 as height. which is getting from the original template.

How can we achieve this? Do you have the fix for this?

Hi,


Well, Aspose.Cells renders the Excel workbook to PDF as per the print preview shown in MS Excel for the sheets. If you find Aspose.Cells does not render as per MS Excel, please share the template Excel file and output PDF here, we will check your issue soon.

Also, please download and try our latest fix/version: Aspose.Cells for .NET v7.4.3.5

Thank you.

Hello Amjad,


Thanks for the quick reply, I saved the document both in Excel and PDF. The excel Print preview shows the rows with the increased height. But the PDF is saving without increasing the height.

Thanks
Arjun.

Hi,


As requested earlier, unless we have your template files or your runnable sample application/code to generate such files, we cannot evaluate your issue properly. Kindly do the needful, we will check your issue soon.

Thank you.

Hi Amjad,


Please see the template and Output in both PDF and Excel format

Attached Files
1) KCMO-20130604-Excel.xls Output
2) KCMO-20130604-PDF.pdf Output
3) KCMO-Template.xls Template

Thanks
Arjun.

Hi,


Thanks for the sample files.

I have used our latest fix/version: Aspose.Cells for .NET v7.4.3.5 (please try it), it works fine. I converted your Excel file to PDF using the following sample code. The output file is attached here for your reference, it is same as the Excel file.

Workbook wb = new Workbook(@“e:\test2\KCMO-20130604-Excel.xls”);
wb.Save(“e:\test2\outKCMO-20130604-Excel.pdf”);

Thank you.

Hi Amjad,


I tried it with new dll, no luck with that. I have seen you output attachment file, but it didn’t work for me.

Thanks
Arjun.

Hi,


Please open my attached PDF file and compare it with the Excel file. If you still find any issue, kindly share some screen shots to highlight the problematic areas encircling in red color, we will check it soon.

If you are creating the PDF on the fly, kindly create a sample console application (runnable), zip it and post it here to show the issue, we will check it soon.

Thank you.

Hi Amjad

Please find the Zip file, sample solution.

Thanks

Arjun.

Hi,


Thanks for the zipped archive.

Well, I checked your zipped archive but it contains only the visual studio solution file (.sln). Please provide us the complete runnable project with all its sources and other files, so we could evaluate your issue on our end.

Thank you.

Please find the attached file

Hi,

Thanks for the sample project with a template file.

I can notice the issue as you mentioned. The row heights are not extended accordingly in the PDF as per MS Excel. I used the following code to simply convert the template file to PDF format.

Sample code:

Dim wb As Workbook = New Workbook(Request.PhysicalApplicationPath & "\KCMO\KCMO-20130605.xls")
wb.Save("c:\\KCMO-20130605.PDF", SaveFormat.Pdf)

I have logged a ticket with an id "CELLSNET-41752" for your issue. We will look into your issue soon. Once we have any update on it, we will let you know here.

Thank you.

Thanks Amjad for the reply, How were you able to convert it in the previous post ?.

And how fast can you provide with the fix. I need it as early as possible.

Thanks
Arjun

Hi,


Well, I was able to convert your previously attached file to render to PDF format and the PDF looked to me fine, you may check it on your end.

For your newly attached project with the template file, as we found the issue and we have already logged it into our database, so we will surely look into it soon. Please spare us some time, we will try to figure it out soon. Once we have any update on it, we will let you know here.

Thank you.
Hi,

Please download and try our latest fix/version : Aspose.Cells for .NET v7.7.0.4

I think you may try:
e.g
Sample code:

Workbook wb = new Workbook(srcFile); //KCMO-20130605.xls

foreach (Worksheet ws in wb.Worksheets)

{

ws.AutoFitRows();

}

wb.Save(outFile.pdf);


It will solve your issue. If you still have any issue or confusion, let us know, we will check it soon.


Thank you.