How can I create a new spreadsheet file using the OOXML SDK that contains multiple worksheets?
I downloaded the OOXML SDK. I need to create a simple Excel spreadsheet that has x worksheets开发者_Python百科, each with 4 columns and y rows of data. It's pretty simple, but I can't find an example of how to create sheets anywhere.
According to the MSDN article How to: Insert a New Worksheet into a Spreadsheet Document, you should be able to add a worksheet to a spreadsheet by adding a WorksheetPart
to a SpreadsheetDocument
, then getting the first child of type Sheets
on the associated Workbook
and appending a new Sheet
instance to it.
精彩评论