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

Free Support Forum - aspose.com

Text not fully visible in merged Cell

When we export to Excel, there is one functionality where there is text data to be exported, so we merge about 20 rows and dump the entire text in the column.
When that happens, the text moves to the last line of the merged cell and only shows a few characters, although the text is there in the cell but on first look it seems that the text is cut off.

How we can fix that so that whole data is visible in the cell?

Hi,

Thanks for your posting and using Aspose.Cells for .NET.

Please download and try the latest version:
Aspose.Cells
for .NET v7.1.2.2
and let us know your feedback.

If it does not resolve your problem, then please provide us your simple sample project that could be run and could replicate this problem.

We will look into it and help you asap.

Hi,


Well, I think you need to use auto-fit rows/cols operation for the merged range of cells, it might suit your needs. See the sample code below:

Sample code:

//Instantiate a new Workbook
Workbook wb = new Workbook();
//Get the first (default) worksheet
Worksheet _worksheet = wb.Worksheets[0];
//Create a range A1:B1
Range range = _worksheet.Cells.CreateRange(0, 0, 1, 2);
//Merge the cells
range.Merge();
//Insert value to the merged cell A1
_worksheet.Cells[0, 0].Value = “A quick brown fox jumps over the lazy dog. A quick brown fox jumps over the lazy dog…end”;
//Create a style object
Aspose.Cells.Style style = _worksheet.Cells[0, 0].GetStyle();
//Set wrapping text on
style.IsTextWrapped = true;
//Apply the style to the cell
_worksheet.Cells[0, 0].SetStyle(style);

//Create an object for AutoFitterOptions
AutoFitterOptions options = new AutoFitterOptions();
//Set auto-fit for merged cells
options.AutoFitMergedCells = true;

//Autofit rows in the sheet(including the merged cells)
_worksheet.AutoFitRows(options);

//Save the Excel file
wb.Save(“e:\test2\autofitmergedcells.xlsx”);