FieldDde Class |
Namespace: Aspose.Words.Fields
The FieldDde type exposes the following members.
Name | Description | |
---|---|---|
![]() | FieldDde | Initializes a new instance of the FieldDde class |
Name | Description | |
---|---|---|
![]() ![]() | AutoUpdate |
Gets or sets whether to update this field automatically.
|
![]() ![]() | DisplayResult |
Gets the text that represents the displayed field result.
(Inherited from Field.) |
![]() ![]() | End |
Gets the node that represents the field end.
(Inherited from Field.) |
![]() ![]() | Format |
Gets a FieldFormat object that provides typed access to field's formatting.
(Inherited from Field.) |
![]() ![]() | InsertAsBitmap |
Gets or sets whether to insert the linked object as a bitmap.
|
![]() ![]() | InsertAsHtml |
Gets or sets whether to insert the linked object as HTML format text.
|
![]() ![]() | InsertAsPicture |
Gets or sets whether to insert the linked object as a picture.
|
![]() ![]() | InsertAsRtf |
Gets or sets whether to insert the linked object in rich-text format (RTF).
|
![]() ![]() | InsertAsText |
Gets or sets whether to insert the linked object in text-only format.
|
![]() ![]() | InsertAsUnicode |
Gets or sets whether to insert the linked object as Unicode text.
|
![]() ![]() | IsDirty |
Gets or sets whether the current result of the field is no longer correct (stale) due to other modifications made to the document.
(Inherited from Field.) |
![]() ![]() | IsLinked |
Gets or sets whether to reduce the file size by not storing graphics data with the document.
|
![]() ![]() | IsLocked |
Gets or sets whether the field is locked (should not recalculate its result).
(Inherited from Field.) |
![]() ![]() | LocaleId |
Gets or sets the LCID of the field.
(Inherited from Field.) |
![]() ![]() | ProgId |
Gets or sets the application type of the link information.
|
![]() ![]() | Result |
Gets or sets text that is between the field separator and field end.
(Inherited from Field.) |
![]() ![]() | Separator |
Gets the node that represents the field separator. Can be null.
(Inherited from Field.) |
![]() ![]() | SourceFullName |
Gets or sets the name and location of the source file.
|
![]() ![]() | SourceItem |
Gets or sets the portion of the source file that's being linked.
|
![]() ![]() | Start |
Gets the node that represents the start of the field.
(Inherited from Field.) |
![]() ![]() | Type |
Gets the Microsoft Word field type.
(Inherited from Field.) |
Name | Description | |
---|---|---|
![]() | Equals | (Inherited from Object.) |
![]() ![]() | GetFieldCode |
Returns text between field start and field separator (or field end if there is no separator).
Both field code and field result of child fields are included.
(Inherited from Field.) |
![]() ![]() | GetFieldCode(Boolean) |
Returns text between field start and field separator (or field end if there is no separator).
(Inherited from Field.) |
![]() | GetHashCode | (Inherited from Object.) |
![]() | GetType | (Inherited from Object.) |
![]() ![]() | Remove |
Removes the field from the document. Returns a node right after the field. If the field's end is the last child
of its parent node, returns its parent paragraph. If the field is already removed, returns null.
(Inherited from Field.) |
![]() | ToString | (Inherited from Object.) |
![]() ![]() | Unlink |
Performs the field unlink.
(Inherited from Field.) |
![]() ![]() | Update |
Performs the field update. Throws if the field is being updated already.
(Inherited from Field.) |
![]() ![]() | Update(Boolean) |
Performs a field update. Throws if the field is being updated already.
(Inherited from Field.) |
public void FieldLinkedObjectsAsText(InsertLinkedObjectAs insertLinkedObjectAs) { Document doc = new Document(); DocumentBuilder builder = new DocumentBuilder(doc); // Insert fields containing text from another document and present them as text (see InsertLinkedObjectAs enum) builder.Writeln("FieldLink:\n"); InsertFieldLink(builder, insertLinkedObjectAs, "Word.Document.8", MyDir + "Document.docx", null, true); builder.Writeln("FieldDde:\n"); InsertFieldDde(builder, insertLinkedObjectAs, "Excel.Sheet", MyDir + "Spreadsheet.xlsx", "Sheet1!R1C1", true, true); builder.Writeln("FieldDdeAuto:\n"); InsertFieldDdeAuto(builder, insertLinkedObjectAs, "Excel.Sheet", MyDir + "Spreadsheet.xlsx", "Sheet1!R1C1", true); doc.UpdateFields(); doc.Save(ArtifactsDir + "Field.LINK.DDE.DDEAUTO.docx"); } public void FieldLinkedObjectsAsImage(InsertLinkedObjectAs insertLinkedObjectAs) { Document doc = new Document(); DocumentBuilder builder = new DocumentBuilder(doc); // Insert one cell from a spreadsheet as an image (see InsertLinkedObjectAs enum) builder.Writeln("FieldLink:\n"); InsertFieldLink(builder, insertLinkedObjectAs, "Excel.Sheet", MyDir + "MySpreadsheet.xlsx", "Sheet1!R2C2", true); builder.Writeln("FieldDde:\n"); InsertFieldDde(builder, insertLinkedObjectAs, "Excel.Sheet", MyDir + "Spreadsheet.xlsx", "Sheet1!R1C1", true, true); builder.Writeln("FieldDdeAuto:\n"); InsertFieldDdeAuto(builder, insertLinkedObjectAs, "Excel.Sheet", MyDir + "Spreadsheet.xlsx", "Sheet1!R1C1", true); doc.UpdateFields(); doc.Save(ArtifactsDir + "Field.LINK.DDE.DDEAUTO.AsImage.docx"); } /// <summary> /// Use a document builder to insert a LINK field and set its properties according to parameters. /// </summary> private static void InsertFieldLink(DocumentBuilder builder, InsertLinkedObjectAs insertLinkedObjectAs, string progId, string sourceFullName, string sourceItem, bool shouldAutoUpdate) { FieldLink field = (FieldLink)builder.InsertField(FieldType.FieldLink, true); switch (insertLinkedObjectAs) { case InsertLinkedObjectAs.Text: field.InsertAsText = true; break; case InsertLinkedObjectAs.Unicode: field.InsertAsUnicode = true; break; case InsertLinkedObjectAs.Html: field.InsertAsHtml = true; break; case InsertLinkedObjectAs.Rtf: field.InsertAsRtf = true; break; case InsertLinkedObjectAs.Picture: field.InsertAsPicture = true; break; case InsertLinkedObjectAs.Bitmap: field.InsertAsBitmap = true; break; } field.AutoUpdate = shouldAutoUpdate; field.ProgId = progId; field.SourceFullName = sourceFullName; field.SourceItem = sourceItem; builder.Writeln("\n"); } /// <summary> /// Use a document builder to insert a DDE field and set its properties according to parameters. /// </summary> private static void InsertFieldDde(DocumentBuilder builder, InsertLinkedObjectAs insertLinkedObjectAs, string progId, string sourceFullName, string sourceItem, bool isLinked, bool shouldAutoUpdate) { FieldDde field = (FieldDde)builder.InsertField(FieldType.FieldDDE, true); switch (insertLinkedObjectAs) { case InsertLinkedObjectAs.Text: field.InsertAsText = true; break; case InsertLinkedObjectAs.Unicode: field.InsertAsUnicode = true; break; case InsertLinkedObjectAs.Html: field.InsertAsHtml = true; break; case InsertLinkedObjectAs.Rtf: field.InsertAsRtf = true; break; case InsertLinkedObjectAs.Picture: field.InsertAsPicture = true; break; case InsertLinkedObjectAs.Bitmap: field.InsertAsBitmap = true; break; } field.AutoUpdate = shouldAutoUpdate; field.ProgId = progId; field.SourceFullName = sourceFullName; field.SourceItem = sourceItem; field.IsLinked = isLinked; builder.Writeln("\n"); } /// <summary> /// Use a document builder to insert a DDEAUTO field and set its properties according to parameters. /// </summary> private static void InsertFieldDdeAuto(DocumentBuilder builder, InsertLinkedObjectAs insertLinkedObjectAs, string progId, string sourceFullName, string sourceItem, bool isLinked) { FieldDdeAuto field = (FieldDdeAuto)builder.InsertField(FieldType.FieldDDEAuto, true); switch (insertLinkedObjectAs) { case InsertLinkedObjectAs.Text: field.InsertAsText = true; break; case InsertLinkedObjectAs.Unicode: field.InsertAsUnicode = true; break; case InsertLinkedObjectAs.Html: field.InsertAsHtml = true; break; case InsertLinkedObjectAs.Rtf: field.InsertAsRtf = true; break; case InsertLinkedObjectAs.Picture: field.InsertAsPicture = true; break; case InsertLinkedObjectAs.Bitmap: field.InsertAsBitmap = true; break; } field.ProgId = progId; field.SourceFullName = sourceFullName; field.SourceItem = sourceItem; field.IsLinked = isLinked; } public enum InsertLinkedObjectAs { // LinkedObjectAsText Text, Unicode, Html, Rtf, // LinkedObjectAsImage Picture, Bitmap }