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

Free Support Forum - aspose.com

Autofit row with text wrapping in columns

Hi ,

I need to keep column width fixed and content of cells under that column can vary (too large or too small) PFA sample excel.

But row height should be adjusted in such a way that cell content should be visible (It should not cut off)

To achieve this I tried
wks.setColumnWidth(0, 2500);

But it didn’t work

Any suggestions/code snippet will be helpful.I am using aspose.cells java component



Thanks for using Aspose.Cells.

Please use the following code to get rid of text cutting issue. I have also attached the output pdf generated by the following code.


string filePath = @“F:\Shak-Data-RW\Downloads\Sample.xls”;

Workbook workbook = new Workbook(filePath);

PdfSaveOptions opts = new PdfSaveOptions();

opts.OnePagePerSheet = true;

workbook.Save(filePath + “.out.pdf”, opts);


Thanks for the reply.

But I need to do text wrapping in excel only , is it possible in excel?
Any code snippet will be helpful(I am using java component of Aspose.cells)


Thanks for your posting and using Aspose.Cells.

It is the behavior of ms excel that row height would not be expanded automatically for merged cells even if the wrap-text property is true. You can only get the row height be auto-fit for those unmerged cells with auto-wrapped text.

Thanks for your quick reply.

Now I Just need to know how to convert width in dpi to cell width in excel



Thanks for your posting and using Aspose.Cells.

Please elaborate your requirements more. We will look into you issue and help you asap.

Hi Shakeel ,

My requirement is to keep column width constant and I have width in pixels .

I achieved this using wks.setColumnWidthPixel property.(So this is resolved now)

But the new problem is when cell content is numeric and its exceeding column width then its displaying ###### instead of actual cell content

Is there any workaround for this in aspose.cells (7.3.0 java component)

Any suggestions will be helpful

Thanks and Best Regards,


Thanks for your posting and using Aspose.Cells.

Please use autofitrow and autofitcolumn. We do not find this issue. You can try to autofit in your end.

In Java environment, please install arial.ttf and set the fonts directory using CellsHelper class.


CellsHelper.setFontDir() method

I can not use autofit Columns since I have fixed column width.



Ms-Excel uses #### to replace the number that can not be displayed.

Please set proper column width which could include the integral part length if you use fixed column width.