TableProperties クラス

定義

テーブルのプロパティです。 オブジェクトを xml としてシリアル化されるときに、修飾名は、w:tblPr です。

[DocumentFormat.OpenXml.ChildElementInfo(typeof(DocumentFormat.OpenXml.Wordprocessing.TableStyle))]
[DocumentFormat.OpenXml.ChildElementInfo(typeof(DocumentFormat.OpenXml.Wordprocessing.TablePositionProperties))]
[DocumentFormat.OpenXml.ChildElementInfo(typeof(DocumentFormat.OpenXml.Wordprocessing.TableOverlap))]
[DocumentFormat.OpenXml.ChildElementInfo(typeof(DocumentFormat.OpenXml.Wordprocessing.BiDiVisual))]
[DocumentFormat.OpenXml.ChildElementInfo(typeof(DocumentFormat.OpenXml.Wordprocessing.TableWidth))]
[DocumentFormat.OpenXml.ChildElementInfo(typeof(DocumentFormat.OpenXml.Wordprocessing.TableJustification))]
[DocumentFormat.OpenXml.ChildElementInfo(typeof(DocumentFormat.OpenXml.Wordprocessing.TableCellSpacing))]
[DocumentFormat.OpenXml.ChildElementInfo(typeof(DocumentFormat.OpenXml.Wordprocessing.TableIndentation))]
[DocumentFormat.OpenXml.ChildElementInfo(typeof(DocumentFormat.OpenXml.Wordprocessing.TableBorders))]
[DocumentFormat.OpenXml.ChildElementInfo(typeof(DocumentFormat.OpenXml.Wordprocessing.Shading))]
[DocumentFormat.OpenXml.ChildElementInfo(typeof(DocumentFormat.OpenXml.Wordprocessing.TableLayout))]
[DocumentFormat.OpenXml.ChildElementInfo(typeof(DocumentFormat.OpenXml.Wordprocessing.TableCellMarginDefault))]
[DocumentFormat.OpenXml.ChildElementInfo(typeof(DocumentFormat.OpenXml.Wordprocessing.TableLook))]
[DocumentFormat.OpenXml.ChildElementInfo(typeof(DocumentFormat.OpenXml.Wordprocessing.TableCaption), DocumentFormat.OpenXml.FileFormatVersions.Office2010)]
[DocumentFormat.OpenXml.ChildElementInfo(typeof(DocumentFormat.OpenXml.Wordprocessing.TableDescription), DocumentFormat.OpenXml.FileFormatVersions.Office2010)]
[DocumentFormat.OpenXml.ChildElementInfo(typeof(DocumentFormat.OpenXml.Wordprocessing.TablePropertiesChange))]
public class TableProperties : DocumentFormat.OpenXml.OpenXmlCompositeElement
type TableProperties = class
    inherit OpenXmlCompositeElement
Public Class TableProperties
Inherits OpenXmlCompositeElement
継承
属性

次のコード例では、TablePropertiesテーブルを作成し、枠線の情報を指定するクラスです。

using System;  
using DocumentFormat.OpenXml;  
using DocumentFormat.OpenXml.Packaging;  
using DocumentFormat.OpenXml.Wordprocessing;  

namespace TablePropertiesEx  
{  
    class Program  
    {  
        // Insert a table into an existing word processing document.  
        static void Main(string[] args)  
        {  
            string fileName = @"C:\users\public\documents\TablePropertiesEx.docx";  
            using (WordprocessingDocument document  
                = WordprocessingDocument.Open(fileName, true))  
            {  
                // Create an empty table.  
                Table table = new Table();  

                // Create a TableProperties object and specify its border information.  
                TableProperties tableProperties = new TableProperties(  
                    new TableBorders(new TopBorder() { Val = new EnumValue<BorderValues>(BorderValues.Birds), Size = 24 },  
                        new BottomBorder() { Val = new EnumValue<BorderValues>(BorderValues.Birds), Size = 24 },  
                        new LeftBorder() { Val = new EnumValue<BorderValues>(BorderValues.Birds), Size = 24 },  
                        new RightBorder() { Val = new EnumValue<BorderValues>(BorderValues.Birds), Size = 24 },  
                        new InsideHorizontalBorder() { Val = new EnumValue<BorderValues>(BorderValues.Birds), Size = 24 },  
                        new InsideVerticalBorder() { Val = new EnumValue<BorderValues>(BorderValues.Birds), Size = 24 })  
                );  

                // Append the TableProperties object to the empty table.  
                table.AppendChild<TableProperties>(tableProperties);  

                // Create a row and a cell.  
                TableRow tableRow = new TableRow();  
                TableCell tableCell1 = new TableCell();  

                // Specify the width property of the table cell.  
                tableCell1.Append(new TableCellProperties(  
                    new TableCellWidth() { Type = TableWidthUnitValues.Dxa, Width = "2400" }));  

                // Write some text in the cell.  
                tableCell1.Append(new Paragraph(new Run(new Text("Some cell text."))));  

                // Append the cell to the row.  
                tableRow.Append(tableCell1);  

                // Create a second table cell by copying the OuterXml value of the first table cell.  
                TableCell tableCell2 = new TableCell(tableCell1.OuterXml);  

                // Append the cell to the row.  
                tableRow.Append(tableCell2);  

                // Append the table row to the table.  
                table.Append(tableRow);  

                // Append the table to the document.  
                document.MainDocumentPart.Document.Body.Append(table);  

                Console.WriteLine("The table has been created.\nPress a key.");  
                Console.ReadKey();  
            }  
        }  
    }  
}  
Imports DocumentFormat.OpenXml  
Imports DocumentFormat.OpenXml.Packaging  
Imports DocumentFormat.OpenXml.Wordprocessing  

Module Module1  
    ' Insert a table into an existing word processing document.  
    Sub Main(ByVal args As String())  
        Dim fileName As String = "C:\users\public\documents\TablePropertiesEx.docx"  
        Using document As WordprocessingDocument = WordprocessingDocument.Open(fileName, True)  
            ' Create an empty table.  
            Dim table As New Table()  

            ' Create a TableProperties object and specify its border information.  
            Dim tableProperties As New TableProperties(New TableBorders(New TopBorder() With { _  
             .Val = New EnumValue(Of BorderValues)(BorderValues.Birds), _  
             .Size = 24 _  
            }, New BottomBorder() With { _  
             .Val = New EnumValue(Of BorderValues)(BorderValues.Birds), _  
             .Size = 24 _  
            }, New LeftBorder() With { _  
             .Val = New EnumValue(Of BorderValues)(BorderValues.Birds), _  
             .Size = 24 _  
            }, New RightBorder() With { _  
             .Val = New EnumValue(Of BorderValues)(BorderValues.Birds), _  
             .Size = 24 _  
            }, New InsideHorizontalBorder() With { _  
             .Val = New EnumValue(Of BorderValues)(BorderValues.Birds), _  
             .Size = 24 _  
            }, New InsideVerticalBorder() With { _  
             .Val = New EnumValue(Of BorderValues)(BorderValues.Birds), _  
             .Size = 24 _  
            }))  

            ' Append the TableProperties object to the empty table.  
            table.AppendChild(Of TableProperties)(tableProperties)  

            ' Create a row and a cell.  
            Dim tableRow As New TableRow()  
            Dim tableCell1 As New TableCell()  

            ' Specify the width property of the table cell.  
            tableCell1.Append(New TableCellProperties(New TableCellWidth() With { _  
             .Type = TableWidthUnitValues.Dxa, _  
             .Width = "2400" _  
            }))  

            ' Write some text in the cell.  
            tableCell1.Append(New Paragraph(New Run(New Text("Some cell text."))))  

            ' Append the cell to the row.  
            tableRow.Append(tableCell1)  

            ' Create a second table cell by copying the OuterXml value of the first table cell.  
            Dim tableCell2 As New TableCell(tableCell1.OuterXml)  

            ' Append the cell to the row.  
            tableRow.Append(tableCell2)  

            ' Append the table row to the table.  
            table.Append(tableRow)  

            ' Append the table to the document.  
            document.MainDocumentPart.Document.Body.Append(table)  

            Console.WriteLine("The table has been created." & vbLf & "Press a key.")  
            Console.ReadKey()  
        End Using  
    End Sub  
End Module  

注釈

[ISO/IEC 29500-1 1st Edition]

tblPr (表のプロパティ)

この要素は、現在のテーブルに適用されるテーブル全体のプロパティのセットを指定します。 これらのプロパティは、すべての行と、親テーブル内のセルの外観に影響を与えるが、各プロパティで定義されている個々 のテーブル レベルの例外、行、およびセル レベルのプロパティによってオーバーライドできます。

[: 次の単純な WordprocessingML 表を検討してください。

このテーブルは、すべての枠線の種類の 1 つのポイント 1 つの境界線を定義し、ページの幅の両方のテーブルのプロパティを 100% に設定。 結果のテーブルは、次の WordprocessingML で表されます。

<w:tbl>  
  <w:tblPr>  
    <w:tblW w:w="0" w:type="auto"/>  
    <w:tblBorders>  
      <w:top w:val="single" w:sz="4" w:space="0" w:color="auto"/>  
      <w:left w:val="single" w:sz="4" w:space="0" w:color="auto"/>  
      <w:bottom w:val="single" w:sz="4" w:space="0" w:color="auto"/>  
      <w:right w:val="single" w:sz="4" w:space="0" w:color="auto"/>  
      <w:insideH w:val="single" w:sz="4" w:space="0" w:color="auto"/>  
      <w:insideV w:val="single" w:sz="4" w:space="0" w:color="auto"/>  
    </w:tblBorders>  
  </w:tblPr>  
  …</w:tbl>  

この例では、tblW 要素 (§17.4.64) は、この例では、自動テーブルを自動的に内容に合わせてサイズが指定の型がセットされると、テーブルの幅の合計を定義します。 TblBorders 要素 (§17.4.39) は、テーブルの枠線のそれぞれを指定し、上部、左、右下のおよび水平方向および垂直方向の枠の中に 1 ポイントの罫線を指定します。 例終わり]

親要素
tbl (§17.4.38)
子要素
bidiVisual (左のテーブルに右では視覚的に) §17.4.1
jc さん (表の配置) §17.4.29
shd の (表の網かけ) §17.4.32
tblBorders (罫線) §17.4.39
tblCaption (表題) §17.4.41
(テーブルのセルの余白の既定値) tblCellMar §17.4.43
(テーブルのセルの間隔の既定) tblCellSpacing §17.4.46
tblDescription (テーブルの説明) §17.4.47
(表の先頭の余白からインデント) tblInd §17.4.51
tblLayout (テーブルのレイアウト) §17.4.53
tblLook (テーブル スタイル条件付き書式設定) §17.4.56
tblOverlap (浮動テーブルでは、その他のテーブルの重複する) §17.4.57
(浮動テーブル配置 (2) tblpPr §17.4.58
tblPrChange (表のプロパティのリビジョン情報) §17.13.5.34
tblStyle (表のスタイルを参照) §17.4.63
tblStyleColBandSize (列数] 列のバンドで) §17.7.6.5
tblStyleRowBandSize (番号の行の行のバンドで) §17.7.6.7
tblW (表の幅を優先) §17.4.64

[: この要素のコンテンツ モデル (CT_TblPr) の W3C XML スキーマ定義は §A.1 であります。 メモの終了)

ISO/IEC29500: 2008。

コンストラクター

TableProperties()

TableProperties クラスの新しいインスタンスを初期化します。

TableProperties(IEnumerable<OpenXmlElement>)

指定した子要素を持つ TableProperties クラスの新しいインスタンスを初期化します。

TableProperties(OpenXmlElement[])

指定した子要素を持つ TableProperties クラスの新しいインスタンスを初期化します。

TableProperties(String)

外側の XML から TableProperties クラスの新しいインスタンスを初期化します。

プロパティ

BiDiVisual

BiDiVisual。 スキーマでは、次の要素タグを表します w:bidiVisual。

ChildElements

現在の要素のすべての子ノードを取得します。

(継承元 OpenXmlElement)
ExtendedAttributes

現在の要素のすべての拡張属性 (スキーマで定義されていない属性) を取得します。

(継承元 OpenXmlElement)
FirstChild

現在の OpenXmlElement 要素の最初の子を取得します。

(継承元 OpenXmlCompositeElement)
HasAttributes

現在の要素に属性が含されているかどうかを示すブール値を取得します。

(継承元 OpenXmlElement)
HasChildren

現在の要素に子要素が含されているかどうかを示す値を取得します。

(継承元 OpenXmlCompositeElement)
InnerText

現在のノードとそのすべての子の連結値を取得または設定します。

(継承元 OpenXmlCompositeElement)
InnerXml

現在のノードの子ノードのみを表すマークアップを取得または設定します。

(継承元 OpenXmlCompositeElement)
LastChild

現在の OpenXmlElement 要素の最後の子を取得します。 このような OpenXmlElement 要素がないVisual Basic null (Nothing in Visual Basic) を返します。

(継承元 OpenXmlCompositeElement)
LocalName

要素のローカル名を取得します。

MCAttributes

マークアップの互換性属性を設定します。 現在の要素に対してマークアップ互換性属性が定義されていない場合は null を返します。

(継承元 OpenXmlElement)
NamespaceDeclarations

現在の要素で定義されている名前空間宣言を取得します。 名前空間宣言がない場合は、空の列挙子を返します。

(継承元 OpenXmlElement)
NamespaceUri

現在の要素の名前空間 URI を取得します。

(継承元 OpenXmlElement)
OpenXmlElementContext

現在の要素の OpenXmlEementContext を取得します。

(継承元 OpenXmlElement)
OuterXml

現在の要素とそのすべての子要素を表すマークアップを取得します。

(継承元 OpenXmlElement)
Parent

現在の要素の親要素を取得します。

(継承元 OpenXmlElement)
Prefix

現在の要素の名前空間プレフィックスを取得します。

(継承元 OpenXmlElement)
Shading

網かけ スキーマでは、次の要素タグを表します w:shd。

TableBorders

TableBorders。 スキーマでは、次の要素タグを表します w:tblBorders。

TableCaption

TableCaption、このプロパティは、Office2010 で利用可能なだけです。 スキーマでは、次の要素タグを表します w:tblCaption。

TableCellMarginDefault

TableCellMarginDefault。 スキーマでは、次の要素タグを表します w:tblCellMar。

TableCellSpacing

TableCellSpacing。 スキーマでは、次の要素タグを表します w:tblCellSpacing。

TableDescription

TableDescription、このプロパティは、Office2010 で利用可能なだけです。 スキーマでは、次の要素タグを表します w:tblDescription。

TableIndentation

TableIndentation。 スキーマでは、次の要素タグを表します w:tblInd。

TableJustification

TableJustification。 スキーマでは、次の要素タグを表します w:jc。

TableLayout

レイアウトします。 スキーマでは、次の要素タグを表します w:tblLayout。

TableLook

TableLook。 スキーマでは、次の要素タグを表します w:tblLook。

TableOverlap

TableOverlap。 スキーマでは、次の要素タグを表します w:tblOverlap。

TablePositionProperties

TablePositionProperties。 スキーマでは、次の要素タグを表します w:tblpPr。

TablePropertiesChange

テーブルのプロパティのリビジョンの情報です。 スキーマでは、次の要素タグを表します w:tblPrChange。

TableStyle

TableStyle。 スキーマでは、次の要素タグを表します w:tblStyle。

TableWidth

TableWidth。 スキーマでは、次の要素タグを表します w:tblW。

XmlQualifiedName

現在の要素の修飾名を取得します。

(継承元 OpenXmlElement)
XName

現在の要素の修飾名を取得します。

(継承元 OpenXmlElement)

メソッド

AddAnnotation(Object)

現在の OpenXmlElement 要素の注釈の一覧にオブジェクトを追加します。

(継承元 OpenXmlElement)
AddNamespaceDeclaration(String, String)

現在のノードに namepace 宣言を追加します。

(継承元 OpenXmlElement)
Ancestors()

現在の要素のすべての先祖を列挙します。

(継承元 OpenXmlElement)
Ancestors<T>()

指定した型を持つ現在の要素の先祖のみを列挙します。

(継承元 OpenXmlElement)
Annotation(Type)

現在の OpenXmlElement 要素から、指定した型の最初の注釈オブジェクトを取得します。

(継承元 OpenXmlElement)
Annotation<T>()

現在の OpenXmlElement 要素から、指定した型の最初の注釈オブジェクトを取得します。

(継承元 OpenXmlElement)
Annotations(Type)

現在の OpenXmlElement 要素の指定した型を持つ注釈のコレクションを取得します。

(継承元 OpenXmlElement)
Annotations<T>()

現在の OpenXmlElement 要素の指定した型を持つ注釈のコレクションを取得します。

(継承元 OpenXmlElement)
Append(IEnumerable<OpenXmlElement>)

要素のリストから、現在の要素の子要素のリストの末尾に各要素を追加します。

(継承元 OpenXmlElement)
Append(OpenXmlElement[])

要素の配列から、現在の要素の子要素のリストの末尾に各要素を追加します。

(継承元 OpenXmlElement)
AppendChild<T>(T)

指定した要素を、現在の要素の子ノードのリストの末尾に追加します。

(継承元 OpenXmlCompositeElement)
ClearAllAttributes()

既知の属性と拡張属性の両方を含む、すべての属性をクリアします。

(継承元 OpenXmlElement)
Clone()

現在のノードの複製を作成します。

(継承元 OpenXmlElement)
CloneNode(Boolean)

このノードの複製を作成します。

Descendants()

現在の要素のすべての子孫を列挙します。

(継承元 OpenXmlElement)
Descendants<T>()

現在の要素の T 型のすべての子孫を列挙します。

(継承元 OpenXmlElement)
Elements()

現在の要素のすべての子を列挙します。

(継承元 OpenXmlElement)
Elements<T>()

指定した型を持つ現在の要素の子のみを列挙します。

(継承元 OpenXmlElement)
ElementsAfter()

現在の要素に従い、現在の要素と同じ親を持つすべての兄弟要素を列挙します。

(継承元 OpenXmlElement)
ElementsBefore()

現在の要素の前に、現在の要素と同じ親を持つすべての兄弟要素を列挙します。

(継承元 OpenXmlElement)
GetAttribute(String, String)

指定したタグ名と名前空間 URI を持つ Open XML 属性を取得します。

(継承元 OpenXmlElement)
GetAttributes()

すべての属性のコピーを含むリストを取得します。

(継承元 OpenXmlElement)
GetEnumerator()

子コレクションを反復処理する列挙子を返します。

(継承元 OpenXmlElement)
GetFirstChild<T>()

型 T の最初の子要素を検索します。

(継承元 OpenXmlElement)
InsertAfter<T>(T, OpenXmlElement)

指定した参照要素の直後に、指定した要素を挿入します。

(継承元 OpenXmlCompositeElement)
InsertAfterSelf<T>(T)

現在の要素の直後に指定した要素を挿入します。

(継承元 OpenXmlElement)
InsertAt<T>(T, Int32)

現在の要素の子の指定したインデックスに、指定した要素を挿入します。

(継承元 OpenXmlCompositeElement)
InsertBefore<T>(T, OpenXmlElement)

指定した参照要素の直前に、指定した要素を挿入します。

(継承元 OpenXmlCompositeElement)
InsertBeforeSelf<T>(T)

現在の要素の直前に指定した要素を挿入します。

(継承元 OpenXmlElement)
IsAfter(OpenXmlElement)

ドキュメントの順序で指定した要素の後に現在の要素が表示されるかどうかを指定します。

(継承元 OpenXmlElement)
IsBefore(OpenXmlElement)

現在の要素が文書の順序で指定された要素の前に表示されるかどうかを指定します。

(継承元 OpenXmlElement)
LookupNamespace(String)

現在のノードのコンテキストで名前空間プレフィックスを解決します。

(継承元 OpenXmlElement)
LookupPrefix(String)

現在の要素スコープ内の名前空間 uri の対応するプレフィックスを検索します。

(継承元 OpenXmlElement)
NextSibling()

現在の OpenXmlElement 要素の直後にある OpenXmlElement 要素を取得します。 次の OpenXmlElement 要素がないVisual Basic null (Nothing in Visual Basic) を返します。

(継承元 OpenXmlElement)
NextSibling<T>()

現在の OpenXmlElement 要素に続く、指定した型を持つ OpenXmlElement 要素を取得します。 次の OpenXmlElement がないVisual Basic null (Nothing in Visual Basic) を返します。

(継承元 OpenXmlElement)
PrependChild<T>(T)

現在の要素の子ノードのリストの先頭に指定した要素を挿入します。

(継承元 OpenXmlCompositeElement)
PreviousSibling()

現在の OpenXmlElement 要素の直前にある OpenXmlElement 要素を取得します。 前の OpenXmlElement 要素がないVisual Basic null ( Nothing in Visual Basic ) を返します。

(継承元 OpenXmlElement)
PreviousSibling<T>()

現在の OpenXmlElement の前に指定された型を持つ OpenXmlElement 要素を取得します。 前の OpenXmlElement 要素がない場合は、null (Visual Basic 内の Nothing) を返します。

(継承元 OpenXmlElement)
Remove()

現在の要素を親から削除します。

(継承元 OpenXmlElement)
RemoveAllChildren()

現在の要素のすべての子要素を削除します。

(継承元 OpenXmlCompositeElement)
RemoveAllChildren<T>()

T 型の現在の要素のすべての子要素を削除します。

(継承元 OpenXmlElement)
RemoveAnnotations(Type)

現在の OpenXmlElement 要素から、指定した型の注釈を削除します。

(継承元 OpenXmlElement)
RemoveAnnotations<T>()

現在の OpenXmlElement 要素から、指定した型の注釈を削除します。

(継承元 OpenXmlElement)
RemoveAttribute(String, String)

現在の要素から属性を削除します。

(継承元 OpenXmlElement)
RemoveChild<T>(T)

指定した子要素を削除します。

(継承元 OpenXmlCompositeElement)
RemoveNamespaceDeclaration(String)

指定したプレフィックスの名前空間宣言を削除します。 プレフィックスがない場合は何も削除しません。

(継承元 OpenXmlElement)
ReplaceChild<T>(OpenXmlElement, T)

現在の要素の子要素の 1 つを別の OpenXmlElement 要素に置き換える。

(継承元 OpenXmlCompositeElement)
SetAttribute(OpenXmlAttribute)

属性を指定した要素に設定します。 属性が既知の属性の場合、属性の値が設定されます。 属性が拡張属性の場合、'openxmlAttribute' が拡張属性リストに追加されます。

(継承元 OpenXmlElement)
SetAttributes(IEnumerable<OpenXmlAttribute>)

要素に対して多数の属性を設定します。 属性が既知の属性の場合、属性の値が設定されます。 属性が拡張属性の場合、'openxmlAttribute' が拡張属性リストに追加されます。

(継承元 OpenXmlElement)
WriteTo(XmlWriter)

現在のノードを指定した XmlWriter に保存します。

(継承元 OpenXmlElement)

明示的なインターフェイスの実装

IEnumerable.GetEnumerator() (継承元 OpenXmlElement)

適用対象