Why not able to print valud in cell

Hi,

I have used this code :

cells2["M4"].PutValue(bwCostFuture); where bwCostFuture is the long value.

but in the excel sheet after execution I see

###########

in "M4" cell.

Please tell me what's going wrong.

Thank you.

Hi,

Thanks for considering Aspose.

Well, you have to adjust M column's width to show the contents properly. Aspose.Cells exposes some utility API to do the task. E.g., The Worksheet class has the following related methods........AutoFitColumn, AutoFitColumns, AutoFitRow, AutoFitRows etc. Moreover you may manually adjust the row heights and column widths, the Cells class has some efficient methods/members: SetColumnWidth, SetRowHeight etc.

For your case you may add a line,

Options:

1). worksheet.AutoFitColumns();........will auto-fit all the columns in the worksheet and expand them wide based on the maximum contents of the cell in each column.

2). worksheet.AutoFitColumn(12);....... will auto-fit only M column.

Alternatively, you may also wrap text (can make more lines of the cell contents) in the cells..... you can adjust the cells (extend their row heights and column widths) and set Cell.Style.IsTextWrapped to true.

Example:

Workbook wb = new Workbook();
Worksheet ws = wb.Worksheets["Sheet1"];
Cells cell = ws.Cells;
cell.SetColumnWidth(0, 35);
cell.SetRowHeight(0,36);
cell[0, 0].PutValue("Voor meer informatie\nga naar de Informatiepagina op\nThis is the third line");
cell[0, 0].Style.IsTextWrapped = true;
ws.AutoFitRow(0);
wb.Save("d:\\test\\wrappedcontents.xls", FileFormatType.Excel2003);

For further reference, Please check:

Thank you.