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

Free Support Forum - aspose.com

API to find cell data over flow to other columns

I want to know if the cell data is bleeding or overflow to other columns.
Could you pls let me know if we have any API to verify data over flow.



Well, I am afraid there is no specific API to do this. However, we do provide a method, i.e., Cell.getWidthOfValue() to check the rough width needed by the cell value (it might not be accurate all the time), so you may use this method to detect the width for the cell in the column. You can compare the width with what you get with Cells.getColumnWidth() for the particular column. So, if it is greater/less than column’s width, you detect if text is overflown or not.
Sample code:

 Workbook workbook = new Workbook("Book1.xlsx");
            Cell cell = workbook.getWorksheets().get(0).getCells().get("A1");
            int width = cell.getWidthOfValue();
            int columnWidth = workbook.getWorksheets().get(0).getCells().getColumnWidthPixel(0);
            if (width > columnWidth)

Hope, this helps a bit.

Is it possible to know the number of columns the overflow is affected,other way the number of columns the the overflow column span.


Well, you may calculate the width of the contiguous columns and sum it by yourself using your own code. Compare the width of the cell’s value with the resultant value (additions of the columns’ widths) for evaluation.