MoveRange/CopyRange methods don't change the position of sheet headers

Posted by: agleon on 14 February 2019, 5:36 am EST

    • Post Options:
    • Link

    Posted 14 February 2019, 5:36 am EST

    I have a sheet that I’m trying to export to a Word document through the save to html range method.

    This sheet has common columns that needs to be included in every table that’s exported to the word document, so I copy/move the columns first to the end of the same sheet and later with each export I copy/move them again to the beginning.

    The problem with this is that for any reason, moveRange method is not moving the header texts for those columns at the end so when later I use copyRange method to copy those columns again the headers remain empty.

    Maybe I’m doing something wrong but I can’t find anything in the documentation to ensure my columns will be copied exactly as they are from one position to another on the same sheet.

    Could you help me with this, please?

    Thanks

  • Posted 18 February 2019, 7:03 am EST

    Hello,

    We are unable to gather proper information from your query. Can you please elaborate more on your issue along with your use case.

    And also elaborate what do you mean by copy/move the columns first to the end of the same sheet and later with each export I copy/move them again to the beginning? Here in case if you are referring to copy and move of columns in a sheet then I would like to clarify that column headers doesn’t gets moved or gets copy pasted on copy pasting entire column.

    Hence, please elaborate your query once again along with your use case in case of further assistance.

    Thanks,

    Reeva

  • Posted 19 February 2019, 10:54 am EST

    Yes, I was trying to say that. Sorry if I wasn’t clear.

    I want to move/copy columns in a sheet with its headers. Is there any way to do that without copying each column header cell text individually?

  • Posted 20 February 2019, 6:27 am EST

    Hi,

    You can move the columns using MoveColumn method.

    You can’t copy a complete column (with header). Consider how would Spread know which column to access when using sheet.Columns[commonName]

    In this case you would need to copy the header cell text individually.

    You can refer to the attached sample for usage of MoveColumn method.

    Regards,

    Jitender

    MoveCol.zip

Need extra support?

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

Learn More

Forum Channels