Free Support Forum - aspose.com

DrawObjectEventHandler text indentation

Hi,
I have observed following behavior with right,left,center indentation is applied on a data of a cell.

1)if the data in a cell is right indented, then the data is bigger then the column, it bleeds in to left most column.

2)if the data in a cell is left indented, then the data is bigger then the column, it bleeds in to right most column.

3)if the data in a cell is center indented, then the data is bigger then the column, it bleeds in to left and right most columns.

case 1: the x coordinates provided by DrawObjectEventHandler is starting from left most column.
Here it should have provide the X co-ordinates from the column the data entered,like below case?

case 2: the x coordinates provided by DrawObjectEventHandler is starting from column the data entered.

case 3: the x coordinates provided by DrawObjectEventHandler is starting from column the data entered.

Could you pls clarify the behavior.
Pls find the snapshot attachment.
Thanks.

@oraspose

Thanks for using Aspose APIs.

We are unable to find snapshots in your post. Could you please check and provide them? Please provide us your runnable sample code and sample Excel file(s) as well. We will look into your issue and help you asap.

Pls find the attachment.

Thx.Sample.zip (58.3 KB)

@oraspose

Thanks for your sample code, sample Excel file and screenshot as well as using Aspose APIs.

We are afraid, we could not execute your code because it is giving us compile time errors (as shown in the following screenshot) and also it is not runnable. We will appreciate, if you could provide us one .java file containing the runnable sample code which we could add in our project and execute it.

Screenshot:

ExcelToPdfConversion.zip (58.4 KB)

Please check the latest upload.

@oraspose

I was able to run your code after some modifications and got the following console output. We have logged the issue in our database for further investigation and for a fix. Once, the issue is resolved or we have some other news for you, we will update you asap.

This issue has been logged as

  • CELLSJAVA-42657 - DrawObjectEventHandler behavior on Text Indentation

Console Output:

Total Pages : 1 Current Page : 0 Cell : indent: X - Left of Cell :50.4: Y - Top of Cell  :54.0
Total Pages : 1 Current Page : 0 Cell : left indentationsssssssssss: X - Left of Cell :153.60349: Y - Top of Cell  :54.0
Total Pages : 1 Current Page : 0 Cell : right indenationsss: X - Left of Cell :102.00174: Y - Top of Cell  :67.988235
Total Pages : 1 Current Page : 0 Cell : centereeeeeeeeeeee: X - Left of Cell :153.60349: Y - Top of Cell  :81.97647

@oraspose

Thanks for using Aspose APIs.

Actually, the X-coordinates are designed to start from left most column. So, case 1 and case 2 are right.

But for case 3 (center alignment), it is little bit special, here the X-coordinates start from the data entered. It is not consistent with case 1 and case 2.

By the way, it seems, you are still on the process trying to get every cell’s coordinates. If it is so, we may consider to add a new API in DrawObjectEventHandler that will allow you to get every cell’s coordinates while rendering.