Align shapes at columns and rows when sheet is not shown

Posted by: christian.baumgartner on 7 March 2023, 7:02 pm EST

  • Posted 7 March 2023, 7:02 pm EST


    I have the requirement to draw shapes and align them at the edges of specific columns/rows like a Gantt chart. I want to prepare the sheet in the background.

    I recognized that getCellRect returns undefined if the sheet is not shown. Is there another way to get the exact coordinates of rows and columns. As a workaround I a summing up column width always before drawing. is there a better way?

    Thanks Christian

  • Posted 9 March 2023, 3:22 pm EST

    Hello Christian,

    Based on your request to align shapes with the edges of rows or columns, we would like to inform you that you can achieve this without knowing the exact coordinates of the rows and columns. Instead, you can use the startRow(), startColumn(), startRowOffset(), startColumnOffset(), endRow(), and endColumn() methods of the GC.Spread.Sheets.Shape class to position the shape at the desired location on the worksheet.

    We have shared a sample code snippet with you to demonstrate how to use these methods effectively. You can refer to the attached sample for a better understanding of the implementation.

    Here is an example code snippet that changes the shape’s location on the worksheet:

    // changes shape's location on worksheet


    If the solution provided does not meet your needs, please let us know your use case in detail, and we will be happy to provide you with an alternative solution. Additionally, if you encounter any issues, please do not hesitate to contact us.

    For further information, please refer to the GC.Spread.Sheets.Shape class documentation, available at

    We hope this information is helpful.



Need extra support?

Upgrade your support plan and get personal unlimited phone support with our customer engagement team

Learn More

Forum Channels