C1FlexGrid - copy selection to clipboard and paste in office

Posted by: wknauf on 12 September 2017, 1:28 am EST

  • Posted 12 September 2017, 1:28 am EST

    Hi community,

    I want to present a sample which copies a range of selected cells to clipboard using the HTML format. This way, the cell content can be pasted to microsoft excel/word/outlook and the formatting is kept.

    Features:

    • "

    • “The sample code copies also the row/column headers for the selected cells.”

    • “Supported cell style formatting: forecolor, backcolor, font (font family and font size are only applied if the are not the C1FlexGrid Defaults)”

    • “merged ranges are supported”

    • “borders - but just basic support…”

    • “column widths - but see below for limitations”

    • “all cell data is copied as string (cell format is set to “@” - relevant for excel paste)”

    "

    Limitations:

    • "
    • “when pasting to Excel, the column widths are ignored. I did not find a way to apply them… Outlook and Word work.”

    "

    The HTML clipboard format is described here: https://msdn.microsoft.com/en-us/library/windows/desktop/ms649015(v=vs.85).aspx

    Hope someone finds this helpful

    Wolfgang

  • Posted 12 September 2017, 6:06 pm EST

    Here is the attachment…

    FlexGridCopyOffice.zip

  • Posted 21 June 2018, 8:00 am EST

    Thanks, Wolfgang! This is brilliant! V.Y.

  • Posted 25 February 2022, 10:52 pm EST

  • Posted 5 March 2024, 6:56 am EST

Need extra support?

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

Learn More

Forum Channels