charts and shapes does not move when row inserted in excel in c# programmatically RRS feed

  • Question

  • When i insert a row in excel charts and other shapes does not move with their cells.
    Lets say i have a chart at A5:D:10, then i insert a row below 2nd row, so now chart should be at A6:D:11, but chart stays their and hides the 5th row.

    I design a template containing chart and shape, then at runtime i am supplying data for chart and changing few properties of shapes. Now my chart contains some data in first 5 rows and i insert row after 2nd row then everything should go one row down, but this is not happening.

    At design time i have checked that charts property to move and size with cells is set to true. Yet this is not happening at runtime programmatically. Although at design time inserting rows have no issues.

    Following is code used to insert row :

    range.Insert(XlInsertShiftDirection.xlShiftDown, XlInsertFormatOrigin.xlFormatFromRightOrBelow);
    Please help me to solve my problem


    • Changed type j4m4l Wednesday, April 18, 2012 7:50 AM
    Wednesday, April 18, 2012 7:42 AM


  • Hi j4m4l,

    Thanks for posting in the MSDN Forum.

    As far as I know that the shap use the postion of the window. It will not move when you insert row.

    It's based on my experience that hard to approach if you insert row manually. If you insert row via program I would recommend you move shape via set Top and Left property.

    Have a good day,


    Tom Xu [MSFT]
    MSDN Community Support | Feedback to us

    Monday, April 23, 2012 8:21 AM