开发者

EXcel VSTO - Transferring a list object onto a worksheet

开发者 https://www.devze.com 2023-03-16 13:02 出处:网络
I have a VSTO add in I am looking to implement. I would like to click a button and a list of products, names, etc would be placed onto the worksheet.

I have a VSTO add in I am looking to implement.

I would like to click a button and a list of products, names, etc would be placed onto the worksheet.

I understand that I could go through each individual item in the list and then write this cell by cell, but is there a way of literally just 'dumping' t开发者_JS百科he data onto the worksheet?

Apologies if this is a really thick question.


Nope, there is no easy way to just 'dump' the data. You're going to have to do it the hard way. Just google for some examples, it's easy enough.

http://www.google.nl/search?q=c%23+export+data+to+excel


That depends on where your "list of products, names, etc" are coming from. If those items are fixed, you can create a template document with a prepared worksheet containing these items. Put this document into an embedded resource of your program. When you want to create a new worksheet from this template, extract your resource to a temporary file and use the Excel API to copy the worksheet from your template to your working document.

Sounds perhaps more complicated than it is. Here

Read a file from a resource and write it to disk in C#

you find an example how to accomplish the "extract file from resource to temporary file" part.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号