SpreadsheetDocument.AddNewPart<T>(String, String) Method
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Adds a new part of type T
.
public override T AddNewPart<T> (string contentType, string id) where T : DocumentFormat.OpenXml.Packaging.OpenXmlPart;
public override T AddNewPart<T> (string contentType, string? id) where T : DocumentFormat.OpenXml.Packaging.OpenXmlPart;
override this.AddNewPart : string * string -> 'T (requires 'T :> DocumentFormat.OpenXml.Packaging.OpenXmlPart)
Public Overrides Function AddNewPart(Of T As OpenXmlPart) (contentType As String, id As String) As T
Type Parameters
- T
The class of the part.
Parameters
- contentType
- String
The content type of the part. Must match the defined content type if the part is fixed content type.
- id
- String
The relationship id. The id will be automatically generated if this param is null.
Returns
The added part.
Exceptions
When the part is not allowed to be referenced by this part.
When the part is fixed content type and the passed in contentType does not match the defined content type.
Thrown when "contentType" is null reference.
Remarks
Mainly used for adding not-fixed content type part - ImagePart, etc.
Applies to
意見反應
https://aka.ms/ContentUserFeedback。
即將登場:在 2024 年,我們將逐步淘汰 GitHub 問題作為內容的意見反應機制,並將它取代為新的意見反應系統。 如需詳細資訊,請參閱:提交並檢視相關的意見反應