Analyzing your prompt, please hold on...
An error occurred while retrieving the results. Please refresh the page and try again.
Aspose.Cells provides an abstract class DrawObjectEventHandler which has a draw() method. The user can implement DrawObjectEventHandler and utilize the draw() method to get the DrawObject and Bound while rendering Excel to PDF or Image. Here is a brief description of the parameters of the draw() method.
drawObject: DrawObject will be initialized and returned when rendering
x: Left of DrawObject
y: Top of DrawObject
width: Width of DrawObject
height: Height of DrawObject
If you are rendering Excel file to PDF, then you can utilize DrawObjectEventHandler class with PdfSaveOptions.DrawObjectEventHandler. Similarly, if you are rendering Excel file to Image, you can utilize DrawObjectEventHandler class with ImageOrPrintOptions.DrawObjectEventHandler.
Please see the following sample code. It loads the sample Excel file and saves it as output PDF. While rendering to PDF, it utilizes PdfSaveOptions.DrawObjectEventHandler property and captures the DrawObject and Bound of existing cells and objects e.g. images etc. If the drawObject type is Cell, it prints its Bound and StringValue. And if the drawObject type is Image, it prints its Bound and Shape Name. Please see the console output of the sample code given below for more help.
[X]: 153.60349 [Y]: 82.94118 [Width]: 103.203476 [Height]: 14.470589 [Cell Value]: This is sample text.
\----------------------
[X]: 267.28854 [Y]: 153.12354 [Width]: 161.25542 [Height]: 128.78824 [Shape Name]: Sun
\----------------------Analyzing your prompt, please hold on...
An error occurred while retrieving the results. Please refresh the page and try again.