简体   繁体   中英

Is there any way to programaticallly save Excel cell to local files that could be load just like "copy and paste" with VSTO?

I've been working with Excel VSTO Add-in these days, and what I need is to load some templates from the database, and fill them in the Excel cells.

The thing is I can only store the data in plain text, the style and format would be missing if I try to copy and paste a target cell and store it somewhere in the notepads (or other editors).

Is there any way to save the cell data with styles to some binary local file (or others), and when I need it sometime, I could load and fill it to a targeted cell, like I have just copied it from some cells else.

Thanks!

PS: the text might have different styles so the storage of cell's formats might not work,

I've attached an example here:

例子

I finally solved it with

Range.Value[XlRangeValueDataType.xlRangeValueXMLSpreadsheet]

It stores the cell as XML, with all the styles I need.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM