MainDocumentPart クラス
定義
重要
一部の情報は、リリース前に大きく変更される可能性があるプレリリースされた製品に関するものです。 Microsoft は、ここに記載されている情報について、明示または黙示を問わず、一切保証しません。
MainDocumentPart を定義します。
public class MainDocumentPart : DocumentFormat.OpenXml.Packaging.OpenXmlPart
type MainDocumentPart = class
inherit OpenXmlPart
Public Class MainDocumentPart
Inherits OpenXmlPart
- 継承
例
次のコード例は、ワードプロセス ドキュメントを開き、ドキュメントのメイン パーツをインスタンス化し、コメント パーツからコメントを読み取り、表示します。
using System;
using System.IO;
using DocumentFormat.OpenXml.Packaging;
namespace MainDocumentPartEx
{
class Program
{
// Get the contents of a document part.
static void Main(string[] args)
{
string document = @"C:\Users\Public\Documents\MainDocumentPartEx.docx";
string comments = null;
// Open the file read-only.
using (WordprocessingDocument wordprocessingDocument =
WordprocessingDocument.Open(document, false))
{
MainDocumentPart mainPart = wordprocessingDocument.MainDocumentPart;
WordprocessingCommentsPart WordprocessingCommentsPart =
mainPart.WordprocessingCommentsPart;
// Read the comments using a stream reader.
using (StreamReader streamReader =
new StreamReader(WordprocessingCommentsPart.GetStream()))
{
comments = streamReader.ReadToEnd();
}
}
Console.WriteLine(comments);
Console.ReadKey();
}
}
}
Imports System.IO
Imports DocumentFormat.OpenXml.Packaging
Module Module1
' Get the contents of a document part.
Sub Main(ByVal args As String())
Dim document As String = "C:\Users\Public\Documents\MainDocumentPartEx.docx"
Dim comments As String = Nothing
' Open the file read-only.
Using wordprocessingDocument As WordprocessingDocument = wordprocessingDocument.Open(document, False)
Dim mainPart As MainDocumentPart = wordprocessingDocument.MainDocumentPart
Dim WordprocessingCommentsPart As WordprocessingCommentsPart = mainPart.WordprocessingCommentsPart
' Read the comments using a stream reader.
Using streamReader As New StreamReader(WordprocessingCommentsPart.GetStream())
comments = streamReader.ReadToEnd()
End Using
End Using
Console.WriteLine(comments)
Console.ReadKey()
End Sub
End Module
コンストラクター
| MainDocumentPart() |
MainDocumentPart の Construtor |
プロパティ
| AlternativeFormatImportParts |
MainDocumentPart の AlternativeFormatImportParts を取得します。 |
| ChartParts |
MainDocumentPart の ChartParts を取得します。 |
| ContentType |
パーツ内のコンテンツ データのコンテンツ タイプ (MIME タイプ) を表します。 (継承元 OpenXmlPart) |
| CustomizationPart |
MainDocumentPart の CustomizationPart を取得します。 |
| CustomXmlParts |
MainDocumentPart の CustomXmlParts を取得します。 |
| DataPartReferenceRelationships |
すべてのリレーションシップ DataPartReferenceRelationship を列挙します。 (継承元 OpenXmlPartContainer) |
| DiagramColorsParts |
MainDocumentPart の DiagramColorsParts を取得します。 |
| DiagramDataParts |
MainDocumentPart の DiagramDataParts を取得します。 |
| DiagramLayoutDefinitionParts |
MainDocumentPart の DiagramLayoutDefinitionParts を取得します。 |
| DiagramPersistLayoutParts |
MainDocumentPart の DiagramPersistLayoutParts を取得します。 |
| DiagramStyleParts |
MainDocumentPart の DiagramStyleParts を取得します。 |
| Document |
このパーツのルート要素を取得/設定します。 |
| DocumentSettingsPart |
MainDocumentPart の DocumentSettingsPart を取得します。 |
| EmbeddedControlPersistenceParts |
MainDocumentPart の EmbeddedControlPersistenceParts を取得します。 |
| EmbeddedObjectParts |
MainDocumentPart の EmbeddedObjectParts を取得します。 |
| EmbeddedPackageParts |
MainDocumentPart の EmbeddedPackageParts を取得します。 |
| EndnotesPart |
MainDocumentPart の EndnotesPart を取得します。 |
| ExternalRelationships |
すべての外部リレーションシップを列挙します。 ハイパーリンクの関係は含まれません。HyperlinkRelationship プロパティを使用してハイパーリンクの関係を列挙します。 (継承元 OpenXmlPartContainer) |
| FontTablePart |
MainDocumentPart の FontTablePart を取得します。 |
| FooterParts |
MainDocumentPart の FooterParts を取得します。 |
| FootnotesPart |
MainDocumentPart の FootnotesPart を取得します。 |
| GlossaryDocumentPart |
MainDocumentPart の GlossaryDocumentPart を取得します。 |
| HeaderParts |
MainDocumentPart の HeaderParts を取得します。 |
| HyperlinkRelationships |
すべてのハイパーリンク関係を列挙します。 (継承元 OpenXmlPartContainer) |
| ImageParts |
MainDocumentPart の ImageParts を取得します。 |
| NumberingDefinitionsPart |
MainDocumentPart の NumberingDefinitionsPart を取得します。 |
| OpenXmlPackage |
OpenXmlPackage コンテナー内のパーツを表します。 (継承元 OpenXmlPart) |
| Parts |
このパーツのリレーションシップ ターゲットであるすべてのパーツを列挙します。 (継承元 OpenXmlPartContainer) |
| RelationshipType |
RelationshipType を取得します。 |
| RootElement |
現在のパーツのルート要素を取得します。 現在のパーツが空の場合、または空ではない場合は null を返し、XML コンテンツ タイプを返します。 (継承元 OpenXmlPart) |
| StyleDefinitionsPart |
MainDocumentPart の StyleDefinitionsPart を取得します。 |
| StylesWithEffectsPart |
MainDocumentPart.の StylesWithEffectsPart を取得します。Office2010 でのみ使用できます。 |
| ThemePart |
MainDocumentPart の ThemePart を取得します。 |
| ThumbnailPart |
MainDocumentPart の ThumbnailPart を取得します。 |
| Uri |
パッケージ内の内部パーツ パスを表します。 (継承元 OpenXmlPart) |
| VbaProjectPart |
MainDocumentPart の VbaProjectPart を取得します。 |
| WebSettingsPart |
MainDocumentPart の WebSettingsPart を取得します。 |
| WordprocessingCommentsExPart |
MainDocumentPart の WordprocessingCommentsExPart を取得します。 |
| WordprocessingCommentsPart |
MainDocumentPart の WordprocessingCommentsPart を取得します。 |
| WordprocessingPeoplePart |
MainDocumentPart の WordprocessingPeoplePart を取得します。 |
| WordprocessingPrinterSettingsParts |
MainDocumentPart の WordprocessingPrinterSettingsParts を取得します。 |