You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/spreadsheet/how-to-insert-a-new-worksheet-into-a-spreadsheet.md
+32-5Lines changed: 32 additions & 5 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -11,7 +11,7 @@ ms.suite: office
11
11
ms.author: o365devx
12
12
author: o365devx
13
13
ms.topic: conceptual
14
-
ms.date: 12/12/2023
14
+
ms.date: 01/09/2025
15
15
ms.localizationpriority: high
16
16
---
17
17
# Insert a new worksheet into a spreadsheet document
@@ -20,25 +20,52 @@ This topic shows how to use the classes in the Open XML SDK for
20
20
Office to insert a new worksheet into a spreadsheet document
21
21
programmatically.
22
22
23
+
## Getting a SpreadsheetDocument Object
23
24
25
+
In the Open XML SDK, the <xref:DocumentFormat.OpenXml.Packaging.SpreadsheetDocument> class represents an
26
+
Excel document package. To open and work with an Excel document, you
27
+
create an instance of the `SpreadsheetDocument` class from the document.
28
+
After you create the instance from the document, you can then obtain
29
+
access to the main workbook part that contains the worksheets. The text
30
+
in the document is represented in the package as XML using `SpreadsheetML` markup.
31
+
32
+
To create the class instance from the document that you call one of the
33
+
<xref:DocumentFormat.OpenXml.Packaging.SpreadsheetDocument.Open*> methods. Several are provided, each
34
+
with a different signature. The sample code in this topic uses the [Open(String, Boolean)](/dotnet/api/documentformat.openxml.packaging.spreadsheetdocument.open?view=openxml-3.0.1#documentformat-openxml-packaging-spreadsheetdocument-open(system-string-system-boolean)) method with a
35
+
signature that requires two parameters. The first parameter takes a full
36
+
path string that represents the document that you want to open. The
37
+
second parameter is either `true` or `false` and represents whether you want the file to
38
+
be opened for editing. Any changes that you make to the document will
0 commit comments