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-chart-into-a-spreadsheet.md
+12-11Lines changed: 12 additions & 11 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -9,7 +9,7 @@ ms.suite: office
9
9
ms.author: o365devx
10
10
author: o365devx
11
11
ms.topic: conceptual
12
-
ms.date: 12/12/2023
12
+
ms.date: 01/14/2025
13
13
ms.localizationpriority: high
14
14
---
15
15
@@ -22,7 +22,7 @@ This topic shows how to use the classes in the Open XML SDK for Office to insert
22
22
In this how-to, you are going to deal with the row, cell, and cell value
23
23
elements. Therefore it is useful to familiarize yourself with these
24
24
elements. The following text from the [!include[ISO/IEC 29500 URL](../includes/iso-iec-29500-link.md)] specification
25
-
introduces row (\<**row**\>) element.
25
+
introduces row (`<row/>`) element.
26
26
27
27
> The row element expresses information about an entire row of a
28
28
> worksheet, and contains all cell definitions for a particular row in
@@ -75,7 +75,7 @@ element.
75
75
## Cell element
76
76
77
77
The following text from the [!include[ISO/IEC 29500 URL](../includes/iso-iec-29500-link.md)] specification
78
-
introduces cell (\<**c**\>) element.
78
+
introduces cell (`<c/>`) element.
79
79
80
80
> This collection represents a cell in the worksheet. Information about
81
81
> the cell's location (reference), value, data type, formatting, and
@@ -118,7 +118,7 @@ element.
118
118
## Cell value element
119
119
120
120
The following text from the [!include[ISO/IEC 29500 URL](../includes/iso-iec-29500-link.md)] specification
121
-
introduces Cell Value (\<**c**\>) element.
121
+
introduces Cell Value (`<c/>`) element.
122
122
123
123
> This element expresses the value contained in a cell. If the cell
124
124
> contains a string, then this value is an index into the shared string
@@ -128,7 +128,7 @@ introduces Cell Value (\<**c**\>) element.
128
128
> element.
129
129
>
130
130
> For applications not wanting to implement the shared string table, an
131
-
> "inline string" may be expressed in an \<**is**\> element under \<**c**\> (instead of a \<**v**\> element under \<**c**\>), in the same way a string would be
131
+
> "inline string" may be expressed in an `<is/>` element under `<c/>` (instead of a `<v/>` element under `<c/>`), in the same way a string would be
@@ -143,7 +143,7 @@ In the following example cell B4 contains the number 360.
143
143
144
144
## How the sample code works
145
145
146
-
After opening the spreadsheet file for read/write access, the code verifies if the specified worksheet exists. It then adds a new <xref:DocumentFormat.OpenXml.Packaging.DrawingsPart> object using the <xref:DocumentFormat.OpenXml.Packaging.OpenXmlPartContainer.AddNewPart*> method, appends it to the worksheet, and saves the worksheet part. The code then adds a new <xref:DocumentFormat.OpenXml.Packaging.ChartPart> object, appends a new <xref:DocumentFormat.OpenXml.Packaging.ChartPart.ChartSpace*> object to the **ChartPart** object, and then appends a new <xref:DocumentFormat.OpenXml.Drawing.Charts.ChartSpace.EditingLanguage*> object to the **ChartSpace*** object that specifies the language for the chart is English-US.
146
+
After opening the spreadsheet file for read/write access, the code verifies if the specified worksheet exists. It then adds a new <xref:DocumentFormat.OpenXml.Packaging.DrawingsPart> object using the <xref:DocumentFormat.OpenXml.Packaging.OpenXmlPartContainer.AddNewPart*> method, appends it to the worksheet, and saves the worksheet part. The code then adds a new <xref:DocumentFormat.OpenXml.Packaging.ChartPart> object, appends a new <xref:DocumentFormat.OpenXml.Packaging.ChartPart.ChartSpace*> object to the `ChartPart` object, and then appends a new <xref:DocumentFormat.OpenXml.Drawing.Charts.ChartSpace.EditingLanguage*> object to the `ChartSpace` object that specifies the language for the chart is English-US.
@@ -153,11 +153,11 @@ After opening the spreadsheet file for read/write access, the code verifies if t
153
153
***
154
154
155
155
156
-
The code creates a new clustered column chart by creating a new <xref:DocumentFormat.OpenXml.Drawing.Charts.BarChart> object with
157
-
<xref:DocumentFormat.OpenXml.Drawing.Charts.BarDirectionValues> object set to **Column** and <xref:DocumentFormat.OpenXml.Drawing.Charts.BarGroupingValues> object set to **Clustered**.
156
+
The code creates a new clustered column chart by creating a new <xref:DocumentFormat.OpenXml.Drawing.Charts.BarChart> object with
157
+
<xref:DocumentFormat.OpenXml.Drawing.Charts.BarDirectionValues> object set to `Column` and <xref:DocumentFormat.OpenXml.Drawing.Charts.BarGroupingValues> object set to `Clustered`.
158
158
159
-
The code then iterates through each key in the **Dictionary** class. For each key, it appends a
160
-
<xref:DocumentFormat.OpenXml.Drawing.Charts.BarChartSeries> object to the **BarChart** object and sets the <xref:DocumentFormat.OpenXml.Drawing.Charts.SeriesText> object of the **BarChartSeries** object to equal the key. For each key, it appends a <xref:DocumentFormat.OpenXml.Drawing.Charts.NumberLiteral> object to the **Values** collection of the **BarChartSeries** object and sets the **NumberLiteral** object to equal the **Dictionary** class value corresponding to the key.
159
+
The code then iterates through each key in the `Dictionary` class. For each key, it appends a
160
+
<xref:DocumentFormat.OpenXml.Drawing.Charts.BarChartSeries> object to the `BarChart` object and sets the <xref:DocumentFormat.OpenXml.Drawing.Charts.SeriesText> object of the `BarChartSeries` object to equal the key. For each key, it appends a <xref:DocumentFormat.OpenXml.Drawing.Charts.NumberLiteral> object to the `Values` collection of the `BarChartSeries` object and sets the `NumberLiteral` object to equal the `Dictionary` class value corresponding to the key.
@@ -177,7 +177,7 @@ The code adds the <xref:DocumentFormat.OpenXml.Drawing.Charts.CategoryAxis> obje
177
177
***
178
178
179
179
180
-
The code positions the chart on the worksheet by creating a <xref:DocumentFormat.OpenXml.Packaging.DrawingsPart.WorksheetDrawing*> object and appending a **TwoCellAnchor** object. The **TwoCellAnchor** object specifies how to move or resize the chart if you move the rows and columns between the <xref:DocumentFormat.OpenXml.Drawing.Spreadsheet.FromMarker> and <xref:DocumentFormat.OpenXml.Drawing.Spreadsheet.ToMarker> anchors. The code then creates a <xref:DocumentFormat.OpenXml.Drawing.Spreadsheet.GraphicFrame> object to contain the chart and names the chart "Chart 1," and saves the worksheet drawing.
180
+
The code positions the chart on the worksheet by creating a <xref:DocumentFormat.OpenXml.Packaging.DrawingsPart.WorksheetDrawing*> object and appending a `TwoCellAnchor` object. The `TwoCellAnchor` object specifies how to move or resize the chart if you move the rows and columns between the <xref:DocumentFormat.OpenXml.Drawing.Spreadsheet.FromMarker> and <xref:DocumentFormat.OpenXml.Drawing.Spreadsheet.ToMarker> anchors. The code then creates a <xref:DocumentFormat.OpenXml.Drawing.Spreadsheet.GraphicFrame> object to contain the chart and names the chart "Chart 1".
0 commit comments