Bookmark.PasteExcelTable Method
Pastes and formats a Microsoft Office Excel table into the Bookmark control.
Namespace: Microsoft.Office.Tools.Word
Assembly: Microsoft.Office.Tools.Word (in Microsoft.Office.Tools.Word.dll)
Syntax
'Declaration
Sub PasteExcelTable ( _
LinkedToExcel As Boolean, _
WordFormatting As Boolean, _
RTF As Boolean _
)
void PasteExcelTable(
bool LinkedToExcel,
bool WordFormatting,
bool RTF
)
Parameters
- LinkedToExcel
Type: System.Boolean
true to link the pasted table to the original Excel file so that changes made to the Excel file are reflected in Microsoft Office Word.
- WordFormatting
Type: System.Boolean
true to format the table using the formatting in the Word document. false to format the table according to the original Excel file.
- RTF
Type: System.Boolean
true to paste the Excel table using Rich Text Format (RTF). false to paste the Excel table as HTML.
Remarks
Calling this method might delete the Bookmark control.
Optional Parameters
For information on optional parameters, see Optional Parameters in Office Solutions.
Examples
The following code example pastes an Excel table into the Bookmark control. The parameters specify that the pasted table is linked to the Excel file, retains the original Excel formatting, and is pasted as RTF. This example requires that the Clipboard contains an Excel table.
This example is for a document-level customization.
Private Sub BookmarkPasteExcelTable()
Me.Paragraphs(1).Range.InsertParagraphBefore()
Dim Bookmark1 As Microsoft.Office.Tools.Word.Bookmark = _
Me.Controls.AddBookmark(Me.Paragraphs(1).Range, "Bookmark1")
Bookmark1.PasteExcelTable(True, False, True)
End Sub
private void BookmarkPasteExcelTable()
{
this.Paragraphs[1].Range.InsertParagraphBefore();
Microsoft.Office.Tools.Word.Bookmark bookmark1 =
this.Controls.AddBookmark(this.Paragraphs[1].Range,
"bookmark1");
bool LinkedToExcel = true;
bool WordFormatting = false;
bool RTF = true;
bookmark1.PasteExcelTable(LinkedToExcel, WordFormatting, RTF);
}
.NET Framework Security
- Full trust for the immediate caller. This member cannot be used by partially trusted code. For more information, see Using Libraries from Partially Trusted Code.