Novacode Namespace

[image]

A Sandcastle Documented Class Library
Novacode Namespace
Send Feedback
Novacode is the namespace I use for all of my personal project.

Classes

Class | Description
Cell |
CustomProperty |
DocProperty | Represents a field of type document property. This field displays the value stored in a custom property.
DocX | Represents a document.
Formatting | A text formatting.
Image | Represents an Image embedded in a document.
Paragraph | Represents a document paragraph.
Picture | Represents a Picture in this document, a Picture is a customized view of an Image.
Row | Represents a single row in a Table.
Table | Represents a Table in a document.

Enumerations

Enumeration | Description
Alignment | Text alignment of a paragraph
AutoFit |
BasicShapes |
BlockArrowShapes |
CalloutShapes |
CapsStyle |
EquationShapes |
FlowchartShapes |
Highlight |
MatchFormattingOptions |
Misc |
RectangleShapes |
RunTextType | Text types in a Run
Script |
StarAndBannerShapes |
StrikeThrough |
TableDesign | Designs\Styles that can be applied to a table.
UnderlineStyle |


Alignment Enumeration

[image]

A Sandcastle Documented Class Library
Alignment Enumeration
See Also Send Feedback
Text alignment of a paragraph

Namespace: Novacode
Assembly: DocX (in DocX.dll) Version: 1.0.0.7 (1.0.0.7)

Syntax

C#
public enum Alignment
Visual Basic (Declaration)
Public Enumeration Alignment
Visual C++
public enum class Alignment

Members

Member name | Description
left | Align text to the left.
center | Center text.
right | Align text to the right.
both | Align text to both the left and right margins, adding extra space between words as necessary.

See Also

Novacode Namespace


AutoFit Enumeration

[image]

A Sandcastle Documented Class Library
AutoFit Enumeration
See Also Send Feedback

[Missing <summary> documentation for "T:Novacode.AutoFit"]

Namespace: Novacode
Assembly: DocX (in DocX.dll) Version: 1.0.0.7 (1.0.0.7)

Syntax

C#
public enum AutoFit
Visual Basic (Declaration)
Public Enumeration AutoFit
Visual C++
public enum class AutoFit

Members

Member name | Description
Contents |
Window |
ColoumnWidth |

See Also

Novacode Namespace


BasicShapes Enumeration

[image]

A Sandcastle Documented Class Library
BasicShapes Enumeration
See Also Send Feedback

[Missing <summary> documentation for "T:Novacode.BasicShapes"]

Namespace: Novacode
Assembly: DocX (in DocX.dll) Version: 1.0.0.7 (1.0.0.7)

Syntax

C#
public enum BasicShapes
Visual Basic (Declaration)
Public Enumeration BasicShapes
Visual C++
public enum class BasicShapes

Members

Member name | Description
ellipse |
triangle |
rtTriangle |
parallelogram |
trapezoid |
diamond |
pentagon |
hexagon |
heptagon |
octagon |
decagon |
dodecagon |
pie |
chord |
teardrop |
frame |
halfFrame |
corner |
diagStripe |
plus |
plaque |
can |
cube |
bevel |
donut |
noSmoking |
blockArc |
foldedCorner |
smileyFace |
heart |
lightningBolt |
sun |
moon |
cloud |
arc |
backetPair |
bracePair |
leftBracket |
rightBracket |
leftBrace |
rightBrace |

See Also

Novacode Namespace


BlockArrowShapes Enumeration

[image]

A Sandcastle Documented Class Library
BlockArrowShapes Enumeration
See Also Send Feedback

[Missing <summary> documentation for "T:Novacode.BlockArrowShapes"]

Namespace: Novacode
Assembly: DocX (in DocX.dll) Version: 1.0.0.7 (1.0.0.7)

Syntax

C#
public enum BlockArrowShapes
Visual Basic (Declaration)
Public Enumeration BlockArrowShapes
Visual C++
public enum class BlockArrowShapes

Members

Member name | Description
rightArrow |
leftArrow |
upArrow |
downArrow |
leftRightArrow |
upDownArrow |
quadArrow |
leftRightUpArrow |
bentArrow |
uturnArrow |
leftUpArrow |
bentUpArrow |
curvedRightArrow |
curvedLeftArrow |
curvedUpArrow |
curvedDownArrow |
stripedRightArrow |
notchedRightArrow |
homePlate |
chevron |
rightArrowCallout |
downArrowCallout |
leftArrowCallout |
upArrowCallout |
leftRightArrowCallout |
quadArrowCallout |
circularArrow |

See Also

Novacode Namespace


CalloutShapes Enumeration

[image]

A Sandcastle Documented Class Library
CalloutShapes Enumeration
See Also Send Feedback

[Missing <summary> documentation for "T:Novacode.CalloutShapes"]

Namespace: Novacode
Assembly: DocX (in DocX.dll) Version: 1.0.0.7 (1.0.0.7)

Syntax

C#
public enum CalloutShapes
Visual Basic (Declaration)
Public Enumeration CalloutShapes
Visual C++
public enum class CalloutShapes

Members

Member name | Description
wedgeRectCallout |
wedgeRoundRectCallout |
wedgeEllipseCallout |
cloudCallout |
borderCallout1 |
borderCallout2 |
borderCallout3 |
accentCallout1 |
accentCallout2 |
accentCallout3 |
callout1 |
callout2 |
callout3 |
accentBorderCallout1 |
accentBorderCallout2 |
accentBorderCallout3 |

See Also

Novacode Namespace


CapsStyle Enumeration

[image]

A Sandcastle Documented Class Library
CapsStyle Enumeration
See Also Send Feedback

[Missing <summary> documentation for "T:Novacode.CapsStyle"]

Namespace: Novacode
Assembly: DocX (in DocX.dll) Version: 1.0.0.7 (1.0.0.7)

Syntax

C#
public enum CapsStyle
Visual Basic (Declaration)
Public Enumeration CapsStyle
Visual C++
public enum class CapsStyle

Members

Member name | Description
none |
caps |
smallCaps |

See Also

Novacode Namespace


Cell Class

[image]

A Sandcastle Documented Class Library
Cell Class
Members See Also Send Feedback

[Missing <summary> documentation for "T:Novacode.Cell"]

Namespace: Novacode
Assembly: DocX (in DocX.dll) Version: 1.0.0.7 (1.0.0.7)

Syntax

C#
public class Cell
Visual Basic (Declaration)
Public Class Cell
Visual C++
public ref class Cell

Inheritance Hierarchy

System..::.Object
Novacode..::.Cell

See Also

Cell Members


Cell Members

[image] [image]

A Sandcastle Documented Class Library
Cell Members
Cell Class Properties See Also Send Feedback

The Cell type exposes the following members.

Properties

Name | Description
Paragraph |
Width | Width in pixels. // Added by Joel, refactored by Cathal

See Also

Cell Class


Cell Properties

[image] [image]

A Sandcastle Documented Class Library
Cell Properties
Cell Class See Also Send Feedback

The Cell type exposes the following members.

Properties

Name | Description
Paragraph |
Width | Width in pixels. // Added by Joel, refactored by Cathal

See Also

Cell Class


Paragraph Property

[image]

A Sandcastle Documented Class Library
Cell..::.Paragraph Property
Cell Class See Also Send Feedback

[Missing <summary> documentation for "P:Novacode.Cell.Paragraph"]

Namespace: Novacode
Assembly: DocX (in DocX.dll) Version: 1.0.0.7 (1.0.0.7)

Syntax

C#
public Paragraph Paragraph { get; set; }
Visual Basic (Declaration)
Public Property Paragraph As Paragraph
Visual C++
public:
property Paragraph^ Paragraph {
    Paragraph^ get ();
    void set (Paragraph^ value);
}

See Also

Cell Class


Width Property

[image]

A Sandcastle Documented Class Library
Cell..::.Width Property
Cell Class See Also Send Feedback
Width in pixels. // Added by Joel, refactored by Cathal

Namespace: Novacode
Assembly: DocX (in DocX.dll) Version: 1.0.0.7 (1.0.0.7)

Syntax

C#
public double Width { get; set; }
Visual Basic (Declaration)
Public Property Width As Double
Visual C++
public:
property double Width {
    double get ();
    void set (double value);
}

See Also

Cell Class


CustomProperty Class

[image]

A Sandcastle Documented Class Library
CustomProperty Class
Members See Also Send Feedback

[Missing <summary> documentation for "T:Novacode.CustomProperty"]

Namespace: Novacode
Assembly: DocX (in DocX.dll) Version: 1.0.0.7 (1.0.0.7)

Syntax

C#
public class CustomProperty
Visual Basic (Declaration)
Public Class CustomProperty
Visual C++
public ref class CustomProperty

Inheritance Hierarchy

System..::.Object
Novacode..::.CustomProperty

See Also

CustomProperty Members


CustomProperty Members

[image] [image]

A Sandcastle Documented Class Library
CustomProperty Members
CustomProperty Class Constructors Properties See Also Send Feedback

The CustomProperty type exposes the following members.

Constructors

Name | Description
CustomProperty | Overloaded.

Properties

Name | Description
Name | The name of this CustomProperty.
Value | The value of this CustomProperty.

See Also

CustomProperty Class


CustomProperty Constructor

[image] [image]

A Sandcastle Documented Class Library
CustomProperty Constructor
CustomProperty Class See Also Send Feedback

Overload List

Name | Description
CustomProperty(String, Boolean) | Create a new CustomProperty to hold a bool.
CustomProperty(String, DateTime) | Create a new CustomProperty to hold a DateTime.
CustomProperty(String, Double) | Create a new CustomProperty to hold a double.
CustomProperty(String, Int32) | Create a new CustomProperty to hold an int.
CustomProperty(String, String) | Create a new CustomProperty to hold a string.

See Also

CustomProperty Class
CustomProperty Members


CustomProperty Constructor (String, Boolean)

[image]

A Sandcastle Documented Class Library
CustomProperty Constructor (String, Boolean)
CustomProperty Class See Also Send Feedback
Create a new CustomProperty to hold a bool.

Namespace: Novacode
Assembly: DocX (in DocX.dll) Version: 1.0.0.7 (1.0.0.7)

Syntax

C#
public CustomProperty(
    string name,
    bool value
)
Visual Basic (Declaration)
Public Sub New ( _
    name As String, _
    value As Boolean _
)
Visual C++
public:
CustomProperty(
    String^ name,
    bool value
)

Parameters

name
Type: System..::.String
The name of this CustomProperty.
value
Type: System..::.Boolean
The value of this CustomProperty.

See Also

CustomProperty Class
CustomProperty Overload


CustomProperty Constructor (String, DateTime)

[image]

A Sandcastle Documented Class Library
CustomProperty Constructor (String, DateTime)
CustomProperty Class See Also Send Feedback
Create a new CustomProperty to hold a DateTime.

Namespace: Novacode
Assembly: DocX (in DocX.dll) Version: 1.0.0.7 (1.0.0.7)

Syntax

C#
public CustomProperty(
    string name,
    DateTime value
)
Visual Basic (Declaration)
Public Sub New ( _
    name As String, _
    value As DateTime _
)
Visual C++
public:
CustomProperty(
    String^ name,
    DateTime value
)

Parameters

name
Type: System..::.String
The name of this CustomProperty.
value
Type: System..::.DateTime
The value of this CustomProperty.

See Also

CustomProperty Class
CustomProperty Overload


CustomProperty Constructor (String, Double)

[image]

A Sandcastle Documented Class Library
CustomProperty Constructor (String, Double)
CustomProperty Class See Also Send Feedback
Create a new CustomProperty to hold a double.

Namespace: Novacode
Assembly: DocX (in DocX.dll) Version: 1.0.0.7 (1.0.0.7)

Syntax

C#
public CustomProperty(
    string name,
    double value
)
Visual Basic (Declaration)
Public Sub New ( _
    name As String, _
    value As Double _
)
Visual C++
public:
CustomProperty(
    String^ name,
    double value
)

Parameters

name
Type: System..::.String
The name of this CustomProperty.
value
Type: System..::.Double
The value of this CustomProperty.

See Also

CustomProperty Class
CustomProperty Overload


CustomProperty Constructor (String, Int32)

[image]

A Sandcastle Documented Class Library
CustomProperty Constructor (String, Int32)
CustomProperty Class See Also Send Feedback
Create a new CustomProperty to hold an int.

Namespace: Novacode
Assembly: DocX (in DocX.dll) Version: 1.0.0.7 (1.0.0.7)

Syntax

C#
public CustomProperty(
    string name,
    int value
)
Visual Basic (Declaration)
Public Sub New ( _
    name As String, _
    value As Integer _
)
Visual C++
public:
CustomProperty(
    String^ name,
    int value
)

Parameters

name
Type: System..::.String
The name of this CustomProperty.
value
Type: System..::.Int32
The value of this CustomProperty.

See Also

CustomProperty Class
CustomProperty Overload


CustomProperty Constructor (String, String)

[image]

A Sandcastle Documented Class Library
CustomProperty Constructor (String, String)
CustomProperty Class See Also Send Feedback
Create a new CustomProperty to hold a string.

Namespace: Novacode
Assembly: DocX (in DocX.dll) Version: 1.0.0.7 (1.0.0.7)

Syntax

C#
public CustomProperty(
    string name,
    string value
)
Visual Basic (Declaration)
Public Sub New ( _
    name As String, _
    value As String _
)
Visual C++
public:
CustomProperty(
    String^ name,
    String^ value
)

Parameters

name
Type: System..::.String
The name of this CustomProperty.
value
Type: System..::.String
The value of this CustomProperty.

See Also

CustomProperty Class
CustomProperty Overload


CustomProperty Properties

[image] [image]

A Sandcastle Documented Class Library
CustomProperty Properties
CustomProperty Class See Also Send Feedback

The CustomProperty type exposes the following members.

Properties

Name | Description
Name | The name of this CustomProperty.
Value | The value of this CustomProperty.

See Also

CustomProperty Class


Name Property

[image]

A Sandcastle Documented Class Library
CustomProperty..::.Name Property
CustomProperty Class See Also Send Feedback
The name of this CustomProperty.

Namespace: Novacode
Assembly: DocX (in DocX.dll) Version: 1.0.0.7 (1.0.0.7)

Syntax

C#
public string Name { get; }
Visual Basic (Declaration)
Public ReadOnly Property Name As String
Visual C++
public:
property String^ Name {
    String^ get ();
}

See Also

CustomProperty Class


Value Property

[image]

A Sandcastle Documented Class Library
CustomProperty..::.Value Property
CustomProperty Class See Also Send Feedback
The value of this CustomProperty.

Namespace: Novacode
Assembly: DocX (in DocX.dll) Version: 1.0.0.7 (1.0.0.7)

Syntax

C#
public Object Value { get; }
Visual Basic (Declaration)
Public ReadOnly Property Value As Object
Visual C++
public:
property Object^ Value {
    Object^ get ();
}

See Also

CustomProperty Class


DocProperty Class

[image]

A Sandcastle Documented Class Library
DocProperty Class
Members See Also Send Feedback
Represents a field of type document property. This field displays the value stored in a custom property.

Namespace: Novacode
Assembly: DocX (in DocX.dll) Version: 1.0.0.7 (1.0.0.7)

Syntax

C#
public class DocProperty
Visual Basic (Declaration)
Public Class DocProperty
Visual C++
public ref class DocProperty

Inheritance Hierarchy

System..::.Object
Novacode..::.DocProperty

See Also

DocProperty Members


DocProperty Members

[image] [image]

A Sandcastle Documented Class Library
DocProperty Members
DocProperty Class Properties See Also Send Feedback

The DocProperty type exposes the following members.

Properties

Name | Description
Name | The custom property to display.

See Also

DocProperty Class


DocProperty Properties

[image] [image]

A Sandcastle Documented Class Library
DocProperty Properties
DocProperty Class See Also Send Feedback

The DocProperty type exposes the following members.

Properties

Name | Description
Name | The custom property to display.

See Also

DocProperty Class


Name Property

[image]

A Sandcastle Documented Class Library
DocProperty..::.Name Property
DocProperty Class See Also Send Feedback
The custom property to display.

Namespace: Novacode
Assembly: DocX (in DocX.dll) Version: 1.0.0.7 (1.0.0.7)

Syntax

C#
public string Name { get; }
Visual Basic (Declaration)
Public ReadOnly Property Name As String
Visual C++
public:
property String^ Name {
    String^ get ();
}

See Also

DocProperty Class


DocX Class

[image]

A Sandcastle Documented Class Library
DocX Class
Members See Also Send Feedback
Represents a document.

Namespace: Novacode
Assembly: DocX (in DocX.dll) Version: 1.0.0.7 (1.0.0.7)

Syntax

C#
public class DocX : IDisposable
Visual Basic (Declaration)
Public Class DocX _
    Implements IDisposable
Visual C++
public ref class DocX : IDisposable

Inheritance Hierarchy

System..::.Object
Novacode..::.DocX

See Also

DocX Members


DocX Members

[image] [image]

A Sandcastle Documented Class Library
DocX Members
DocX Class Methods Properties See Also Send Feedback

The DocX type exposes the following members.

Methods

Name | Description
AddCustomProperty | Add a custom property to this document. If a custom property already exists with the same name it will be replace. CustomProperty names are case insensitive.
AddImage | Overloaded.
Create | Overloaded.
Dispose | Releases all resources used by this document.
FindAll | Overloaded.
InsertDocument | Insert the contents of another document at the end of this document.
InsertParagraph | Overloaded.
InsertTable | Overloaded.
Load | Overloaded.
ReplaceText | Overloaded.
Save | Save this document back to the location it was loaded from.
SaveAs | Overloaded.

Properties

Name | Description
CustomProperties | Returns a list of custom properties in this document.
FooterText | Gets the concatenated text of all footer files in this document.
HeaderText | Gets the concatenated text of all header files in this document.
Images | Returns a list of Images in this document.
Paragraphs | Returns a list of Paragraphs in this document.
Tables | Returns a list of Tables in this Paragraph.
Text | Get the Text of this document.

See Also

DocX Class


DocX Methods

[image] [image]

A Sandcastle Documented Class Library
DocX Methods
DocX Class See Also Send Feedback

The DocX type exposes the following members.

Methods

Name | Description
AddCustomProperty | Add a custom property to this document. If a custom property already exists with the same name it will be replace. CustomProperty names are case insensitive.
AddImage | Overloaded.
Create | Overloaded.
Dispose | Releases all resources used by this document.
FindAll | Overloaded.
InsertDocument | Insert the contents of another document at the end of this document.
InsertParagraph | Overloaded.
InsertTable | Overloaded.
Load | Overloaded.
ReplaceText | Overloaded.
Save | Save this document back to the location it was loaded from.
SaveAs | Overloaded.

See Also

DocX Class


AddCustomProperty Method

[image]

A Sandcastle Documented Class Library
DocX..::.AddCustomProperty Method
DocX Class Example See Also Send Feedback
Add a custom property to this document. If a custom property already exists with the same name it will be replace. CustomProperty names are case insensitive.

Namespace: Novacode
Assembly: DocX (in DocX.dll) Version: 1.0.0.7 (1.0.0.7)

Syntax

C#
public void AddCustomProperty(
    CustomProperty cp
)
Visual Basic (Declaration)
Public Sub AddCustomProperty ( _
    cp As CustomProperty _
)
Visual C++
public:
void AddCustomProperty(
    CustomProperty^ cp
)

Parameters

cp
Type: Novacode..::.CustomProperty
The CustomProperty to add to this document.

Examples

Add a custom properties of each type to a document.
CopyC#
// Load Example.docx
using (DocX document = DocX.Load(@"C:\Example\Test.docx"))
{
    // A CustomProperty called forename which stores a string.
    CustomProperty forename;

    // If this document does not contain a custom property called 'forename', create one.
    if (!document.CustomProperties.ContainsKey("forename"))
    {
        // Create a new custom property called 'forename' and set its value.
        document.AddCustomProperty(new CustomProperty("forename", "Cathal"));
    }

    // Get this documents custom property called 'forename'.
    forename = document.CustomProperties["forename"];

    // Print all of the information about this CustomProperty to Console.
    Console.WriteLine(string.Format("Name: '{0}', Value: '{1}'\nPress any key...", forename.Name, forename.Value));

    // Save all changes made to this document.
    document.Save();
} // Release this document from memory.

// Wait for the user to press a key before exiting.
Console.ReadKey();

See Also

DocX Class
Novacode Namespace
Novacode..::.CustomProperty
DocX..::.CustomProperties


AddImage Method

[image] [image]

A Sandcastle Documented Class Library
DocX..::.AddImage Method
DocX Class See Also Send Feedback

Overload List

Name | Description
AddImage(Stream) | Add an Image into this document from a Stream.
AddImage(String) | Add an Image into this document from a fully qualified or relative filename.

See Also

DocX Class
DocX Members


AddImage Method (Stream)

[image]

A Sandcastle Documented Class Library
DocX..::.AddImage Method (Stream)
DocX Class Example See Also Send Feedback
Add an Image into this document from a Stream.

Namespace: Novacode
Assembly: DocX (in DocX.dll) Version: 1.0.0.7 (1.0.0.7)

Syntax

C#
public Image AddImage(
    Stream stream
)
Visual Basic (Declaration)
Public Function AddImage ( _
    stream As Stream _
) As Image
Visual C++
public:
Image^ AddImage(
    Stream^ stream
)

Parameters

stream
Type: System.IO..::.Stream
A Stream stream.

Return Value

An Image file.

Examples

Add an Image into a document using a Stream.
CopyC#
// Open a FileStream fs to an Image.
using (FileStream fs = new FileStream(@"C:\Example\Image.jpg", FileMode.Open))
{
    // Load a document.
    using (DocX document = DocX.Load(@"C:\Example\Test.docx"))
    {
        // Add an Image from a filestream fs.
        document.AddImage(fs);

        // Save all changes made to this document.
        document.Save();
    }// Release this document from memory.
}

See Also

DocX Class
AddImage Overload
Novacode Namespace
DocX..::.AddImage(String)
Paragraph..::.InsertPicture(String, String, String)


AddImage Method (String)

[image]

A Sandcastle Documented Class Library
DocX..::.AddImage Method (String)
DocX Class Example See Also Send Feedback
Add an Image into this document from a fully qualified or relative filename.

Namespace: Novacode
Assembly: DocX (in DocX.dll) Version: 1.0.0.7 (1.0.0.7)

Syntax

C#
public Image AddImage(
    string filename
)
Visual Basic (Declaration)
Public Function AddImage ( _
    filename As String _
) As Image
Visual C++
public:
Image^ AddImage(
    String^ filename
)

Parameters

filename
Type: System..::.String
The fully qualified or relative filename.

Return Value

An Image file.

Examples

Add an Image into this document from a fully qualified filename.
CopyC#
// Load a document.
using (DocX document = DocX.Load(@"C:\Example\Test.docx"))
{
    // Add an Image from a file.
    document.AddImage(@"C:\Example\Image.png");

    // Save all changes made to this document.
    document.Save();
}// Release this document from memory.

See Also

DocX Class
AddImage Overload
Novacode Namespace
DocX..::.AddImage(Stream)
Paragraph..::.InsertPicture(String, String, String)


Create Method

[image] [image]

A Sandcastle Documented Class Library
DocX..::.Create Method
DocX Class See Also Send Feedback

Overload List

Name | Description
Create(Stream) | Creates a document using a Stream.
Create(String) | Creates a document using a fully qualified or relative filename.

See Also

DocX Class
DocX Members


Create Method (Stream)

[image]

A Sandcastle Documented Class Library
DocX..::.Create Method (Stream)
DocX Class Example See Also Send Feedback
Creates a document using a Stream.

Namespace: Novacode
Assembly: DocX (in DocX.dll) Version: 1.0.0.7 (1.0.0.7)

Syntax

C#
public static DocX Create(
    Stream stream
)
Visual Basic (Declaration)
Public Shared Function Create ( _
    stream As Stream _
) As DocX
Visual C++
public:
static DocX^ Create(
    Stream^ stream
)

Parameters

stream
Type: System.IO..::.Stream
The Stream to create the document from.

Return Value

Returns a DocX object which represents the document.

Examples

Creating a document from a FileStream.
CopyC#
// Use a FileStream fs to create a new document.
using(FileStream fs = new FileStream(@"C:\Example\Test.docx", FileMode.Create))
{
    // Load the document using fs
    using (DocX document = DocX.Create(fs))
    {
        // Do something with the document here.

        // Save all changes made to this document.
        document.Save();
    }// Release this document from memory.
}

Examples

Creating a document in a SharePoint site.
CopyC#
using(SPSite mySite = new SPSite("http://server/sites/site"))
{
    // Open a connection to the SharePoint site
    using(SPWeb myWeb = mySite.OpenWeb())
    {
        // Create a MemoryStream ms.
        using (MemoryStream ms = new MemoryStream())
        {
            // Create a document using ms.
            using (DocX document = DocX.Create(ms))
            {
                // Do something with the document here.

                // Save all changes made to this document.
                document.Save();
            }// Release this document from memory

            // Add the document to the SharePoint site
            web.Files.Add("filename", ms.ToArray(), true);
        }
    }
}

See Also

DocX Class
Create Overload
Novacode Namespace
DocX..::.Create(String)
DocX..::.Load(Stream)
DocX..::.Load(String)
DocX..::.Save()()()


Create Method (String)

[image]

A Sandcastle Documented Class Library
DocX..::.Create Method (String)
DocX Class Example See Also Send Feedback
Creates a document using a fully qualified or relative filename.

Namespace: Novacode
Assembly: DocX (in DocX.dll) Version: 1.0.0.7 (1.0.0.7)

Syntax

C#
public static DocX Create(
    string filename
)
Visual Basic (Declaration)
Public Shared Function Create ( _
    filename As String _
) As DocX
Visual C++
public:
static DocX^ Create(
    String^ filename
)

Parameters

filename
Type: System..::.String
The fully qualified or relative filename.

Return Value

Returns a DocX object which represents the document.

Examples

CopyC#
// Create a document using a relative filename.
using (DocX document = DocX.Create(@"..\Test.docx"))
{
    // Do something with the document here.

    // Save all changes made to this document.
    document.Save();
}// Release this document from memory
CopyC#
// Create a document using a relative filename.
using (DocX document = DocX.Create(@"..\Test.docx"))
{
    // Do something with the document here.

    // Save all changes made to this document.
    document.Save();
}// Release this document from memory

See Also

DocX Class
Create Overload
Novacode Namespace
DocX..::.Create(Stream)
DocX..::.Load(Stream)
DocX..::.Load(String)
DocX..::.Save()()()


Dispose Method

[image]

A Sandcastle Documented Class Library
DocX..::.Dispose Method
DocX Class Example See Also Send Feedback
Releases all resources used by this document.

Namespace: Novacode
Assembly: DocX (in DocX.dll) Version: 1.0.0.7 (1.0.0.7)

Syntax

C#
public void Dispose()
Visual Basic (Declaration)
Public Sub Dispose
Visual C++
public:
virtual void Dispose() sealed

Implements

IDisposable..::.Dispose()()()

Examples

If you take advantage of the using keyword, Dispose() is automatically called for you.
CopyC#
// Load document.
using (DocX document = DocX.Load(@"C:\Example\Test.docx"))
{
     // The document is only in memory while in this scope.

}// Dispose() is automatically called at this point.

Examples

This example is equilivant to the one above example.
CopyC#
// Load document.
DocX document = DocX.Load(@"C:\Example\Test.docx");

// Do something with the document here.

// Dispose of the document.
document.Dispose();

See Also

DocX Class


FindAll Method

[image] [image]

A Sandcastle Documented Class Library
DocX..::.FindAll Method
DocX Class See Also Send Feedback

Overload List

Name | Description
FindAll(String) | Find all instances of a string in this document and return their indexes in a List.
FindAll(String, RegexOptions) | Find all instances of a string in this document and return their indexes in a List.

See Also

DocX Class
DocX Members


FindAll Method (String)

[image]

A Sandcastle Documented Class Library
DocX..::.FindAll Method (String)
DocX Class Example See Also Send Feedback
Find all instances of a string in this document and return their indexes in a List.

Namespace: Novacode
Assembly: DocX (in DocX.dll) Version: 1.0.0.7 (1.0.0.7)

Syntax

C#
public List<int> FindAll(
    string str
)
Visual Basic (Declaration)
Public Function FindAll ( _
    str As String _
) As List(Of Integer)
Visual C++
public:
List<int>^ FindAll(
    String^ str
)

Parameters

str
Type: System..::.String
The string to find

Return Value

A list of indexes.

Examples

Find all instances of Hello in this document.
CopyC#
// Load a document
using (DocX document = DocX.Load(@"Test.docx"))
{
    // Find all instances of 'Hello' in this document.
    List<int> hellos = document.FindAll("Hello");

    // Print out each index that 'Hello' was found at.
    foreach (int index in hellos)
        Console.WriteLine("Line {0}", index);

}// Release this document from memory.

See Also

DocX Class
FindAll Overload


FindAll Method (String, RegexOptions)

[image]

A Sandcastle Documented Class Library
DocX..::.FindAll Method (String, RegexOptions)
DocX Class Example See Also Send Feedback
Find all instances of a string in this document and return their indexes in a List.

Namespace: Novacode
Assembly: DocX (in DocX.dll) Version: 1.0.0.7 (1.0.0.7)

Syntax

C#
public List<int> FindAll(
    string str,
    RegexOptions options
)
Visual Basic (Declaration)
Public Function FindAll ( _
    str As String, _
    options As RegexOptions _
) As List(Of Integer)
Visual C++
public:
List<int>^ FindAll(
    String^ str,
    RegexOptions options
)

Parameters

str
Type: System..::.String
The string to find
options
Type: System.Text.RegularExpressions..::.RegexOptions
The options to use when finding a string match.

Return Value

A list of indexes.

Examples

Find all instances of Hello in this document (Ignore case).
CopyC#
// Load a document
using (DocX document = DocX.Load(@"Test.docx"))
{
    // Find all instances of 'Hello' in this document.
    List<int> hellos = document.FindAll("Hello", RegexOptions.IgnoreCase);

    // Print out each index that 'Hello' was found at.
    foreach (int index in hellos)
        Console.WriteLine("Line {0}", index);

}// Release this document from memory.

See Also

DocX Class
FindAll Overload


InsertDocument Method

[image]

A Sandcastle Documented Class Library
DocX..::.InsertDocument Method
DocX Class Example See Also Send Feedback
Insert the contents of another document at the end of this document.

Namespace: Novacode
Assembly: DocX (in DocX.dll) Version: 1.0.0.7 (1.0.0.7)

Syntax

C#
public void InsertDocument(
    DocX document
)
Visual Basic (Declaration)
Public Sub InsertDocument ( _
    document As DocX _
)
Visual C++
public:
void InsertDocument(
    DocX^ document
)

Parameters

document
Type: Novacode..::.DocX
The document to insert at the end of this document.

Examples

Create a new document and insert an old document into it.
CopyC#
// Create a new document.
using (DocX newDocument = DocX.Create(@"NewDocument.docx"))
{
    // Load an old document.
    using (DocX oldDocument = DocX.Load(@"OldDocument.docx"))
    {
        // Insert the old document into the new document.
        newDocument.InsertDocument(oldDocument);

        // Save the new document.
        newDocument.Save();
    }// Release the old document from memory.
}// Release the new document from memory.

Remarks

If the document being inserted contains Images, CustomProperties and or custom styles, these will be correctly inserted into the new document. In the case of Images, new ID's are generated for the Images being inserted to avoid ID conflicts. CustomProperties with the same name will be ignored not replaced.

See Also

DocX Class


InsertParagraph Method

[image] [image]

A Sandcastle Documented Class Library
DocX..::.InsertParagraph Method
DocX Class See Also Send Feedback

Overload List

Name | Description
InsertParagraph()()() | Insert a new Paragraph at the end of this document.
InsertParagraph(Paragraph) | Insert a Paragraph into this document, this Paragraph may have come from the same or another document.
InsertParagraph(Int32, Paragraph) | Insert a Paragraph into this document, this Paragraph may have come from the same or another document.
InsertParagraph(String, Boolean) | Insert a new Paragraph at the end of this document.
InsertParagraph(Int32, String, Boolean) | Insert a new Paragraph into this document at a specified index.
InsertParagraph(String, Boolean, Formatting) | Insert a new Paragraph at the end of a document with text formatting.
InsertParagraph(Int32, String, Boolean, Formatting) | Insert a new Paragraph into this document at a specified index with text formatting.

See Also

DocX Class
DocX Members


InsertParagraph Method

[image]

A Sandcastle Documented Class Library
DocX..::.InsertParagraph Method
DocX Class Example See Also Send Feedback
Insert a new Paragraph at the end of this document.

Namespace: Novacode
Assembly: DocX (in DocX.dll) Version: 1.0.0.7 (1.0.0.7)

Syntax

C#
public Paragraph InsertParagraph()
Visual Basic (Declaration)
Public Function InsertParagraph As Paragraph
Visual C++
public:
Paragraph^ InsertParagraph()

Return Value

A new Paragraph.

Examples

Inserting a new Paragraph at the end of a document.
CopyC#
// Load a document.
using (DocX document = DocX.Load(@"C:\Example\Test.docx"))
{
    // Insert a new Paragraph at the end of this document.
    document.InsertParagraph();

    // Save all changes made to this document.
    document.Save();
}// Release this document from memory

See Also

DocX Class
InsertParagraph Overload


InsertParagraph Method (Paragraph)

[image]

A Sandcastle Documented Class Library
DocX..::.InsertParagraph Method (Paragraph)
DocX Class Example See Also Send Feedback
Insert a Paragraph into this document, this Paragraph may have come from the same or another document.

Namespace: Novacode
Assembly: DocX (in DocX.dll) Version: 1.0.0.7 (1.0.0.7)

Syntax

C#
public Paragraph InsertParagraph(
    Paragraph p
)
Visual Basic (Declaration)
Public Function InsertParagraph ( _
    p As Paragraph _
) As Paragraph
Visual C++
public:
Paragraph^ InsertParagraph(
    Paragraph^ p
)

Parameters

p
Type: Novacode..::.Paragraph
The Paragraph to insert.

Return Value

The Paragraph now associated with this document.

Examples

Take a Paragraph from document a, and insert it into the end of document b.
CopyC#
// Place holder for a Paragraph.
Paragraph p;

// Load document a.
using (DocX documentA = DocX.Load(@"C:\Example\a.docx"))
{
    // Get the first paragraph from this document.
    p = documentA.Paragraphs[0];
}

// Load document b.
using (DocX documentB = DocX.Load(@"C:\Example\b.docx"))
{
    /*
     * Insert the Paragraph that was extracted from document a, into docment b.
     * This creates a new Paragraph that is now associated with document b.
     */
     Paragraph newParagraph = documentB.InsertParagraph(p);

    // Save all changes made to document b.
    documentB.Save();
}// Release this document from memory.

See Also

DocX Class
InsertParagraph Overload


InsertParagraph Method (Int32, Paragraph)

[image]

A Sandcastle Documented Class Library
DocX..::.InsertParagraph Method (Int32, Paragraph)
DocX Class Example See Also Send Feedback
Insert a Paragraph into this document, this Paragraph may have come from the same or another document.

Namespace: Novacode
Assembly: DocX (in DocX.dll) Version: 1.0.0.7 (1.0.0.7)

Syntax

C#
public Paragraph InsertParagraph(
    int index,
    Paragraph p
)
Visual Basic (Declaration)
Public Function InsertParagraph ( _
    index As Integer, _
    p As Paragraph _
) As Paragraph
Visual C++
public:
Paragraph^ InsertParagraph(
    int index,
    Paragraph^ p
)

Parameters

index
Type: System..::.Int32
The index to insert this Paragragraph at.
p
Type: Novacode..::.Paragraph
The Paragraph to insert.

Return Value

The Paragraph now associated with this document.

Examples

Take a Paragraph from document a, and insert it into document b at a specified position.
CopyC#
// Place holder for a Paragraph.
Paragraph p;

// Load document a.
using (DocX documentA = DocX.Load(@"C:\Example\a.docx"))
{
    // Get the first paragraph from this document.
    p = documentA.Paragraphs[0];
}

// Load document b.
using (DocX documentB = DocX.Load(@"C:\Example\b.docx"))
{
    /*
     * Insert the Paragraph that was extracted from document a, into docment b.
     * This creates a new Paragraph that is now associated with document b.
     */
     Paragraph newParagraph = documentB.InsertParagraph(0, p);

    // Save all changes made to document b.
    documentB.Save();
}// Release this document from memory.

See Also

DocX Class
InsertParagraph Overload


InsertParagraph Method (String, Boolean)

[image]

A Sandcastle Documented Class Library
DocX..::.InsertParagraph Method (String, Boolean)
DocX Class Example See Also Send Feedback
Insert a new Paragraph at the end of this document.

Namespace: Novacode
Assembly: DocX (in DocX.dll) Version: 1.0.0.7 (1.0.0.7)

Syntax

C#
public Paragraph InsertParagraph(
    string text,
    bool trackChanges
)
Visual Basic (Declaration)
Public Function InsertParagraph ( _
    text As String, _
    trackChanges As Boolean _
) As Paragraph
Visual C++
public:
Paragraph^ InsertParagraph(
    String^ text,
    bool trackChanges
)

Parameters

text
Type: System..::.String
The text of this Paragraph.
trackChanges
Type: System..::.Boolean
Should this insertion be tracked as a change?

Return Value

A new Paragraph.

Examples

Inserting a new Paragraph at the end of a document with text formatting.
CopyC#
// Load a document.
using (DocX document = DocX.Load(@"C:\Example\Test.docx"))
{
    // Insert a new Paragraph at the end of this document.
    document.InsertParagraph("New text", false);

    // Save all changes made to this document.
    document.Save();
}// Release this document from memory

See Also

DocX Class
InsertParagraph Overload


InsertParagraph Method (Int32, String, Boolean)

[image]

A Sandcastle Documented Class Library
DocX..::.InsertParagraph Method (Int32, String, Boolean)
DocX Class Example See Also Send Feedback
Insert a new Paragraph into this document at a specified index.

Namespace: Novacode
Assembly: DocX (in DocX.dll) Version: 1.0.0.7 (1.0.0.7)

Syntax

C#
public Paragraph InsertParagraph(
    int index,
    string text,
    bool trackChanges
)
Visual Basic (Declaration)
Public Function InsertParagraph ( _
    index As Integer, _
    text As String, _
    trackChanges As Boolean _
) As Paragraph
Visual C++
public:
Paragraph^ InsertParagraph(
    int index,
    String^ text,
    bool trackChanges
)

Parameters

index
Type: System..::.Int32
The character index to insert this document at.
text
Type: System..::.String
The text of this Paragraph.
trackChanges
Type: System..::.Boolean
Should this insertion be tracked as a change?

Return Value

A new Paragraph.

Examples

Insert a new Paragraph into the middle of a document.
CopyC#
 // Load a document.
 using (DocX document = DocX.Load(@"C:\Example\Test.docx"))
 {
     // Find the middle character index of this document.
     int index = document.Text.Length / 2;

     // Insert a new Paragraph at the middle of this document.
     document.InsertParagraph(index, "New text", false);

     // Save all changes made to this document.
     document.Save();
}// Release this document from memory

See Also

DocX Class
InsertParagraph Overload


InsertParagraph Method (String, Boolean, Formatting)

[image]

A Sandcastle Documented Class Library
DocX..::.InsertParagraph Method (String, Boolean, Formatting)
DocX Class Example See Also Send Feedback
Insert a new Paragraph at the end of a document with text formatting.

Namespace: Novacode
Assembly: DocX (in DocX.dll) Version: 1.0.0.7 (1.0.0.7)

Syntax

C#
public Paragraph InsertParagraph(
    string text,
    bool trackChanges,
    Formatting formatting
)
Visual Basic (Declaration)
Public Function InsertParagraph ( _
    text As String, _
    trackChanges As Boolean, _
    formatting As Formatting _
) As Paragraph
Visual C++
public:
Paragraph^ InsertParagraph(
    String^ text,
    bool trackChanges,
    Formatting^ formatting
)

Parameters

text
Type: System..::.String
The text of this Paragraph.
trackChanges
Type: System..::.Boolean
Should this insertion be tracked as a change?
formatting
Type: Novacode..::.Formatting
The formatting for the text of this Paragraph.

Return Value

A new Paragraph.

Examples

Inserting a new Paragraph at the end of a document with text formatting.
CopyC#
// Load a document.
using (DocX document = DocX.Load(@"C:\Example\Test.docx"))
{
    // Create a Formatting object
    Formatting formatting = new Formatting();
    formatting.Bold = true;
    formatting.FontColor = Color.Red;
    formatting.Size = 30;

    // Insert a new Paragraph at the end of this document with text formatting.
    document.InsertParagraph("New text", false, formatting);

    // Save all changes made to this document.
    document.Save();
}// Release this document from memory

See Also

DocX Class
InsertParagraph Overload


InsertParagraph Method (Int32, String, Boolean, Formatting)

[image]

A Sandcastle Documented Class Library
DocX..::.InsertParagraph Method (Int32, String, Boolean, Formatting)
DocX Class Example See Also Send Feedback
Insert a new Paragraph into this document at a specified index with text formatting.

Namespace: Novacode
Assembly: DocX (in DocX.dll) Version: 1.0.0.7 (1.0.0.7)

Syntax

C#
public Paragraph InsertParagraph(
    int index,
    string text,
    bool trackChanges,
    Formatting formatting
)
Visual Basic (Declaration)
Public Function InsertParagraph ( _
    index As Integer, _
    text As String, _
    trackChanges As Boolean, _
    formatting As Formatting _
) As Paragraph
Visual C++
public:
Paragraph^ InsertParagraph(
    int index,
    String^ text,
    bool trackChanges,
    Formatting^ formatting
)

Parameters

index
Type: System..::.Int32
The character index to insert this document at.
text
Type: System..::.String
The text of this Paragraph.
trackChanges
Type: System..::.Boolean
Should this insertion be tracked as a change?
formatting
Type: Novacode..::.Formatting
The formatting for the text of this Paragraph.

Return Value

A new Paragraph.

Examples

Insert a new Paragraph into the middle of a document with text formatting.
CopyC#
// Load a document.
using (DocX document = DocX.Load(@"C:\Example\Test.docx"))
{
    // Create a Formatting object
    Formatting formatting = new Formatting();
    formatting.Bold = true;
    formatting.FontColor = Color.Red;
    formatting.Size = 30;

    //  Middle character index of this document.
    int index = document.Text.Length / 2;

    // Insert a new Paragraph in the middle of this document.
    document.InsertParagraph(index, "New text", false, formatting);

    // Save all changes made to this document.
    document.Save();
}// Release this document from memory

Remarks

You must add a reference to System.Drawing in order to use Color.Red.

See Also

DocX Class
InsertParagraph Overload


InsertTable Method

[image] [image]

A Sandcastle Documented Class Library
DocX..::.InsertTable Method
DocX Class See Also Send Feedback

Overload List

Name | Description
InsertTable(Table) | Insert a Table into this document. The Table's source can be a completely different document.
InsertTable(Int32, Table) | Insert a Table into this document. The Table's source can be a completely different document.
InsertTable(Int32, Int32) | Insert a new Table at the end of this document.
InsertTable(Int32, Int32, Int32) | Insert a new Table at the end of this document.

See Also

DocX Class
DocX Members


InsertTable Method (Table)

[image]

A Sandcastle Documented Class Library
DocX..::.InsertTable Method (Table)
DocX Class Example See Also Send Feedback
Insert a Table into this document. The Table's source can be a completely different document.

Namespace: Novacode
Assembly: DocX (in DocX.dll) Version: 1.0.0.7 (1.0.0.7)

Syntax

C#
public Table InsertTable(
    Table t
)
Visual Basic (Declaration)
Public Function InsertTable ( _
    t As Table _
) As Table
Visual C++
public:
Table^ InsertTable(
    Table^ t
)

Parameters

t
Type: Novacode..::.Table
The Table to insert.

Return Value

The Table now associated with this document.

Examples

Extract a Table from document a and insert it at the end of document b.
CopyC#
// Place holder for a Table.
Table t;

// Load document a.
using (DocX documentA = DocX.Load(@"C:\Example\a.docx"))
{
    // Get the first Table from this document.
    t = documentA.Tables[0];
}

// Load document b.
using (DocX documentB = DocX.Load(@"C:\Example\b.docx"))
{
    /*
     * Insert the Table that was extracted from document a, into document b.
     * This creates a new Table that is now associated with document b.
     */
    Table newTable = documentB.InsertTable(t);

    // Save all changes made to document b.
    documentB.Save();
}// Release this document from memory.

See Also

DocX Class
InsertTable Overload


InsertTable Method (Int32, Table)

[image]

A Sandcastle Documented Class Library
DocX..::.InsertTable Method (Int32, Table)
DocX Class Example See Also Send Feedback
Insert a Table into this document. The Table's source can be a completely different document.

Namespace: Novacode
Assembly: DocX (in DocX.dll) Version: 1.0.0.7 (1.0.0.7)

Syntax

C#
public Table InsertTable(
    int index,
    Table t
)
Visual Basic (Declaration)
Public Function InsertTable ( _
    index As Integer, _
    t As Table _
) As Table
Visual C++
public:
Table^ InsertTable(
    int index,
    Table^ t
)

Parameters

index
Type: System..::.Int32
The index to insert this Table at.
t
Type: Novacode..::.Table
The Table to insert.

Return Value

The Table now associated with this document.

Examples

Extract a Table from document a and insert it into document b, at index 10.
CopyC#
// Place holder for a Table.
Table t;

// Load document a.
using (DocX documentA = DocX.Load(@"C:\Example\a.docx"))
{
    // Get the first Table from this document.
    t = documentA.Tables[0];
}

// Load document b.
using (DocX documentB = DocX.Load(@"C:\Example\b.docx"))
{
    /*
     * Insert the Table that was extracted from document a, into document b.
     * This creates a new Table that is now associated with document b.
     */
    Table newTable = documentB.InsertTable(10, t);

    // Save all changes made to document b.
    documentB.Save();
}// Release this document from memory.

See Also

DocX Class
InsertTable Overload


InsertTable Method (Int32, Int32)

[image]

A Sandcastle Documented Class Library
DocX..::.InsertTable Method (Int32, Int32)
DocX Class Example See Also Send Feedback
Insert a new Table at the end of this document.

Namespace: Novacode
Assembly: DocX (in DocX.dll) Version: 1.0.0.7 (1.0.0.7)

Syntax

C#
public Table InsertTable(
    int coloumnCount,
    int rowCount
)
Visual Basic (Declaration)
Public Function InsertTable ( _
    coloumnCount As Integer, _
    rowCount As Integer _
) As Table
Visual C++
public:
Table^ InsertTable(
    int coloumnCount,
    int rowCount
)

Parameters

coloumnCount
Type: System..::.Int32
The number of coloumns to create.
rowCount
Type: System..::.Int32
The number of rows to create.

Return Value

A new Table.

Examples

Insert a new Table with 2 coloumns and 3 rows, at the end of a document.
CopyC#
// Create a document.
using (DocX document = DocX.Create(@"C:\Example\Test.docx"))
{
    // Create a new Table with 2 coloumns and 3 rows.
    Table newTable = document.InsertTable(2, 3);

    // Set the design of this Table.
    newTable.Design = TableDesign.LightShadingAccent2;

    // Set the coloumn names.
    newTable.Rows[0].Cells[0].Paragraph.InsertText("Ice Cream", false);
    newTable.Rows[0].Cells[1].Paragraph.InsertText("Price", false);

    // Fill row 1
    newTable.Rows[1].Cells[0].Paragraph.InsertText("Chocolate", false);
    newTable.Rows[1].Cells[1].Paragraph.InsertText("€3:50", false);

    // Fill row 2
    newTable.Rows[2].Cells[0].Paragraph.InsertText("Vanilla", false);
    newTable.Rows[2].Cells[1].Paragraph.InsertText("€3:00", false);

    // Save all changes made to document b.
    document.Save();
}// Release this document from memory.

See Also

DocX Class
InsertTable Overload


InsertTable Method (Int32, Int32, Int32)

[image]

A Sandcastle Documented Class Library
DocX..::.InsertTable Method (Int32, Int32, Int32)
DocX Class Example See Also Send Feedback
Insert a new Table at the end of this document.

Namespace: Novacode
Assembly: DocX (in DocX.dll) Version: 1.0.0.7 (1.0.0.7)

Syntax

C#
public Table InsertTable(
    int index,
    int coloumnCount,
    int rowCount
)
Visual Basic (Declaration)
Public Function InsertTable ( _
    index As Integer, _
    coloumnCount As Integer, _
    rowCount As Integer _
) As Table
Visual C++
public:
Table^ InsertTable(
    int index,
    int coloumnCount,
    int rowCount
)

Parameters

index
Type: System..::.Int32
The index to insert this Table at.
coloumnCount
Type: System..::.Int32
The number of coloumns to create.
rowCount
Type: System..::.Int32
The number of rows to create.

Return Value

A new Table.

Examples

Insert a new Table with 2 coloumns and 3 rows, at index 37 in this document.
CopyC#
// Create a document.
using (DocX document = DocX.Load(@"C:\Example\Test.docx"))
{
    // Create a new Table with 2 coloumns and 3 rows. Insert this Table at index 37.
    Table newTable = document.InsertTable(37, 2, 3);

    // Set the design of this Table.
    newTable.Design = TableDesign.LightShadingAccent3;

    // Set the coloumn names.
    newTable.Rows[0].Cells[0].Paragraph.InsertText("Ice Cream", false);
    newTable.Rows[0].Cells[1].Paragraph.InsertText("Price", false);

    // Fill row 1
    newTable.Rows[1].Cells[0].Paragraph.InsertText("Chocolate", false);
    newTable.Rows[1].Cells[1].Paragraph.InsertText("€3:50", false);

    // Fill row 2
    newTable.Rows[2].Cells[0].Paragraph.InsertText("Vanilla", false);
    newTable.Rows[2].Cells[1].Paragraph.InsertText("€3:00", false);

    // Save all changes made to document b.
    document.Save();
}// Release this document from memory.

See Also

DocX Class
InsertTable Overload


Load Method

[image] [image]

A Sandcastle Documented Class Library
DocX..::.Load Method
DocX Class See Also Send Feedback

Overload List

Name | Description
Load(Stream) | Loads a document into a DocX object using a Stream.
Load(String) | Loads a document into a DocX object using a fully qualified or relative filename.

See Also

DocX Class
DocX Members


Load Method (Stream)

[image]

A Sandcastle Documented Class Library
DocX..::.Load Method (Stream)
DocX Class Example See Also Send Feedback
Loads a document into a DocX object using a Stream.

Namespace: Novacode
Assembly: DocX (in DocX.dll) Version: 1.0.0.7 (1.0.0.7)

Syntax

C#
public static DocX Load(
    Stream stream
)
Visual Basic (Declaration)
Public Shared Function Load ( _
    stream As Stream _
) As DocX
Visual C++
public:
static DocX^ Load(
    Stream^ stream
)

Parameters

stream
Type: System.IO..::.Stream
The Stream to load the document from.

Return Value

Returns a DocX object which represents the document.

Examples

Loading a document from a FileStream.
CopyC#
// Open a FileStream fs to a document.
using (FileStream fs = new FileStream(@"C:\Example\Test.docx", FileMode.Open))
{
    // Load the document using fs.
    using (DocX document = DocX.Load(fs))
    {
        // Do something with the document here.

        // Save all changes made to the document.
        document.Save();
    }// Release this document from memory.
}

Examples

Loading a document from a SharePoint site.
CopyC#
// Get the SharePoint site that you want to access.
using (SPSite mySite = new SPSite("http://server/sites/site"))
{
    // Open a connection to the SharePoint site
    using (SPWeb myWeb = mySite.OpenWeb())
    {
        // Grab a document stored on this site.
        SPFile file = web.GetFile("Source_Folder_Name/Source_File");

        // DocX.Load requires a Stream, so open a Stream to this document.
        Stream str = new MemoryStream(file.OpenBinary());

        // Load the file using the Stream str.
        using (DocX document = DocX.Load(str))
        {
            // Do something with the document here.

            // Save all changes made to the document.
            document.Save();
        }// Release this document from memory.
    }
}

See Also

DocX Class
Load Overload
Novacode Namespace
DocX..::.Load(String)
DocX..::.Create(Stream)
DocX..::.Create(String)
DocX..::.Save()()()


Load Method (String)

[image]

A Sandcastle Documented Class Library
DocX..::.Load Method (String)
DocX Class Example See Also Send Feedback
Loads a document into a DocX object using a fully qualified or relative filename.

Namespace: Novacode
Assembly: DocX (in DocX.dll) Version: 1.0.0.7 (1.0.0.7)

Syntax

C#
public static DocX Load(
    string filename
)
Visual Basic (Declaration)
Public Shared Function Load ( _
    filename As String _
) As DocX
Visual C++
public:
static DocX^ Load(
    String^ filename
)

Parameters

filename
Type: System..::.String
The fully qualified or relative filename.

Return Value

Returns a DocX object which represents the document.

Examples

CopyC#
// Load a document using its fully qualified filename
using (DocX document = DocX.Load(@"C:\Example\Test.docx"))
{
    // Do something with the document here

    // Save all changes made to document.
    document.Save();
}// Release this document from memory.
CopyC#
// Load a document using its relative filename.
using(DocX document = DocX.Load(@"..\..\Test.docx"))
{
    // Do something with the document here.

    // Save all changes made to document.
    document.Save();
}// Release this document from memory.

See Also

DocX Class
Load Overload
Novacode Namespace
DocX..::.Load(Stream)
DocX..::.Create(Stream)
DocX..::.Create(String)
DocX..::.Save()()()


ReplaceText Method

[image] [image]

A Sandcastle Documented Class Library
DocX..::.ReplaceText Method
DocX Class See Also Send Feedback

Overload List

Name | Description
ReplaceText(String, String, Boolean) | Replace text in this document, case sensetive.
ReplaceText(String, String, Boolean, RegexOptions) | Replace text in this document, not case sensetive.
ReplaceText(String, String, Boolean, Boolean, Boolean) | Replace text in this document, case sensetive, include the headers and footers.
ReplaceText(String, String, Boolean, Boolean, Boolean, RegexOptions) | Replace text in this document, ignore case, include the headers and footers.
ReplaceText(String, String, Boolean, Boolean, Boolean, RegexOptions, Formatting, Formatting, MatchFormattingOptions) | Replace text in this document, ignore case, include the headers and footers.

See Also

DocX Class
DocX Members


ReplaceText Method (String, String, Boolean)

[image]

A Sandcastle Documented Class Library
DocX..::.ReplaceText Method (String, String, Boolean)
DocX Class Example See Also Send Feedback
Replace text in this document, case sensetive.

Namespace: Novacode
Assembly: DocX (in DocX.dll) Version: 1.0.0.7 (1.0.0.7)

Syntax

C#
public void ReplaceText(
    string oldValue,
    string newValue,
    bool trackChanges
)
Visual Basic (Declaration)
Public Sub ReplaceText ( _
    oldValue As String, _
    newValue As String, _
    trackChanges As Boolean _
)
Visual C++
public:
void ReplaceText(
    String^ oldValue,
    String^ newValue,
    bool trackChanges
)

Parameters

oldValue
Type: System..::.String
The text to replace.
newValue
Type: System..::.String
The new text to insert.
trackChanges
Type: System..::.Boolean
Should this change be tracked?

Examples

Replace every instance of "old" in this document with "new".
CopyC#
// Load a document.
using (DocX document = DocX.Load(@"C:\Example\Test.docx"))
{
    // Replace every instance of "old" in this document with "new".
    document.ReplaceText("old", "new", false);

    // Save all changes made to this document.
    document.Save();
}// Release this document from memory.

See Also

DocX Class
ReplaceText Overload


ReplaceText Method (String, String, Boolean, RegexOptions)

[image]

A Sandcastle Documented Class Library
DocX..::.ReplaceText Method (String, String, Boolean, RegexOptions)
DocX Class Example See Also Send Feedback
Replace text in this document, not case sensetive.

Namespace: Novacode
Assembly: DocX (in DocX.dll) Version: 1.0.0.7 (1.0.0.7)

Syntax

C#
public void ReplaceText(
    string oldValue,
    string newValue,
    bool trackChanges,
    RegexOptions options
)
Visual Basic (Declaration)
Public Sub ReplaceText ( _
    oldValue As String, _
    newValue As String, _
    trackChanges As Boolean, _
    options As RegexOptions _
)
Visual C++
public:
void ReplaceText(
    String^ oldValue,
    String^ newValue,
    bool trackChanges,
    RegexOptions options
)

Parameters

oldValue
Type: System..::.String
The text to replace.
newValue
Type: System..::.String
The new text to insert.
trackChanges
Type: System..::.Boolean
Should this change be tracked?
options
Type: System.Text.RegularExpressions..::.RegexOptions
RegexOptions to use for this text replace.

Examples

Replace every instance of "old" in this document with "new".
CopyC#
// Load a document.
using (DocX document = DocX.Load(@"C:\Example\Test.docx"))
{
    // Replace every instance of "old" in this document with "new".
    document.ReplaceText("old", "new", false, RegexOptions.IgnoreCase);

    // Save all changes made to this document.
    document.Save();
}// Release this document from memory.

See Also

DocX Class
ReplaceText Overload


ReplaceText Method (String, String, Boolean, Boolean, Boolean)

[image]

A Sandcastle Documented Class Library
DocX..::.ReplaceText Method (String, String, Boolean, Boolean, Boolean)
DocX Class Example See Also Send Feedback
Replace text in this document, case sensetive, include the headers and footers.

Namespace: Novacode
Assembly: DocX (in DocX.dll) Version: 1.0.0.7 (1.0.0.7)

Syntax

C#
public void ReplaceText(
    string oldValue,
    string newValue,
    bool includeHeaders,
    bool includeFooters,
    bool trackChanges
)
Visual Basic (Declaration)
Public Sub ReplaceText ( _
    oldValue As String, _
    newValue As String, _
    includeHeaders As Boolean, _
    includeFooters As Boolean, _
    trackChanges As Boolean _
)
Visual C++
public:
void ReplaceText(
    String^ oldValue,
    String^ newValue,
    bool includeHeaders,
    bool includeFooters,
    bool trackChanges
)

Parameters

oldValue
Type: System..::.String
The text to replace.
newValue
Type: System..::.String
The new text to insert.
includeHeaders
Type: System..::.Boolean
Should ReplaceText include text in the headers?
includeFooters
Type: System..::.Boolean
Should ReplaceText include text in the footers?
trackChanges
Type: System..::.Boolean
Should this change be tracked?

Examples

Replace every instance of "old" in this document with "new".
CopyC#
// Load a document.
using (DocX document = DocX.Load(@"C:\Example\Test.docx"))
{
    // Replace every instance of "old" in this document with "new", include headers and footers in ReplaceText.
    document.ReplaceText("old", "new", true, true, false);

    // Save all changes made to this document.
    document.Save();
}// Release this document from memory.

See Also

DocX Class
ReplaceText Overload


ReplaceText Method (String, String, Boolean, Boolean, Boolean, RegexOptions)

[image]

A Sandcastle Documented Class Library
DocX..::.ReplaceText Method (String, String, Boolean, Boolean, Boolean, RegexOptions)
DocX Class Example See Also Send Feedback
Replace text in this document, ignore case, include the headers and footers.

Namespace: Novacode
Assembly: DocX (in DocX.dll) Version: 1.0.0.7 (1.0.0.7)

Syntax

C#
public void ReplaceText(
    string oldValue,
    string newValue,
    bool includeHeaders,
    bool includeFooters,
    bool trackChanges,
    RegexOptions options
)
Visual Basic (Declaration)
Public Sub ReplaceText ( _
    oldValue As String, _
    newValue As String, _
    includeHeaders As Boolean, _
    includeFooters As Boolean, _
    trackChanges As Boolean, _
    options As RegexOptions _
)
Visual C++
public:
void ReplaceText(
    String^ oldValue,
    String^ newValue,
    bool includeHeaders,
    bool includeFooters,
    bool trackChanges,
    RegexOptions options
)

Parameters

oldValue
Type: System..::.String
The text to replace.
newValue
Type: System..::.String
The new text to insert.
includeHeaders
Type: System..::.Boolean
Should ReplaceText include text in the headers?
includeFooters
Type: System..::.Boolean
Should ReplaceText include text in the footers?
trackChanges
Type: System..::.Boolean
Should this change be tracked?
options
Type: System.Text.RegularExpressions..::.RegexOptions
RegexOptions to use for this text replace.

Examples

Replace every instance of "old" in this document with "new".
CopyC#
// Load a document.
using (DocX document = DocX.Load(@"C:\Example\Test.docx"))
{
    // Replace every instance of "old" in this document with "new", include headers and footers in ReplaceText.
    document.ReplaceText("old", "new", true, true, false, RegexOptions.IgnoreCase);

    // Save all changes made to this document.
    document.Save();
}// Release this document from memory.

See Also

DocX Class
ReplaceText Overload


ReplaceText Method (String, String, Boolean, Boolean, Boolean, RegexOptions, Formatting, Formatting, MatchFormattingOptions)

[image]

A Sandcastle Documented Class Library
DocX..::.ReplaceText Method (String, String, Boolean, Boolean, Boolean, RegexOptions, Formatting, Formatting, MatchFormattingOptions)
DocX Class Example See Also Send Feedback
Replace text in this document, ignore case, include the headers and footers.

Namespace: Novacode
Assembly: DocX (in DocX.dll) Version: 1.0.0.7 (1.0.0.7)

Syntax

C#
public void ReplaceText(
    string oldValue,
    string newValue,
    bool includeHeaders,
    bool includeFooters,
    bool trackChanges,
    RegexOptions options,
    Formatting newFormatting,
    Formatting matchFormatting,
    MatchFormattingOptions fo
)
Visual Basic (Declaration)
Public Sub ReplaceText ( _
    oldValue As String, _
    newValue As String, _
    includeHeaders As Boolean, _
    includeFooters As Boolean, _
    trackChanges As Boolean, _
    options As RegexOptions, _
    newFormatting As Formatting, _
    matchFormatting As Formatting, _
    fo As MatchFormattingOptions _
)
Visual C++
public:
void ReplaceText(
    String^ oldValue,
    String^ newValue,
    bool includeHeaders,
    bool includeFooters,
    bool trackChanges,
    RegexOptions options,
    Formatting^ newFormatting,
    Formatting^ matchFormatting,
    MatchFormattingOptions fo
)

Parameters

oldValue
Type: System..::.String
The text to replace.
newValue
Type: System..::.String
The new text to insert.
includeHeaders
Type: System..::.Boolean
Should ReplaceText include text in the headers?
includeFooters
Type: System..::.Boolean
Should ReplaceText include text in the footers?
trackChanges
Type: System..::.Boolean
Should this change be tracked?
options
Type: System.Text.RegularExpressions..::.RegexOptions
RegexOptions to use for this text replace.
newFormatting
Type: Novacode..::.Formatting
The formatting to apply to the text being inserted.
matchFormatting
Type: Novacode..::.Formatting
The formatting that the text must match in order to be replaced.
fo
Type: Novacode..::.MatchFormattingOptions
How should formatting be matched?

Examples

Replace every instance of "old" in this document with "new".
CopyC#
// Load a document.
using (DocX document = DocX.Load(@"Test.docx"))
{
    // The formatting to match.
    Formatting matchFormatting = new Formatting();
    matchFormatting.Size = 10;
    matchFormatting.Italic = true;
    matchFormatting.FontFamily = new FontFamily("Times New Roman");

    // The formatting to apply to the inserted text.
    Formatting newFormatting = new Formatting();
    newFormatting.Size = 22;
    newFormatting.UnderlineStyle = UnderlineStyle.dotted;
    newFormatting.Bold = true;

    /*
     * Replace all instances of the string "old" with the string "new", include both the header and footer and ignore case.
     * Each inserted instance of "new" should use the Formatting newFormatting.
     * Only replace an instance of "old" if it is Size 10, Italic and Times New Roman.
     * SubsetMatch means that the formatting must contain all elements of the match formatting,
     * but it can also contain additional formatting for example Color, UnderlineStyle, etc.
     * ExactMatch means it must not contain additional formatting.
     */
    document.ReplaceText("old", "new", true, true, false, RegexOptions.IgnoreCase, newFormatting, matchFormatting, MatchFormattingOptions.SubsetMatch);

    // Save all changes made to this document.
    document.Save();
}// Release this document from memory.

See Also

DocX Class
ReplaceText Overload


Save Method

[image]

A Sandcastle Documented Class Library
DocX..::.Save Method
DocX Class Example See Also Send Feedback
Save this document back to the location it was loaded from.

Namespace: Novacode
Assembly: DocX (in DocX.dll) Version: 1.0.0.7 (1.0.0.7)

Syntax

C#
public void Save()
Visual Basic (Declaration)
Public Sub Save
Visual C++
public:
void Save()

Examples

CopyC#
// Load a document.
using (DocX document = DocX.Load(@"C:\Example\Test.docx"))
{
    // Add an Image from a file.
    document.AddImage(@"C:\Example\Image.jpg");

    // Save all changes made to this document.
    document.Save();
}// Release this document from memory.

See Also

DocX Class
Novacode Namespace
DocX..::.SaveAs(String)
DocX..::.Create(Stream)
DocX..::.Create(String)
DocX..::.Load(Stream)
DocX..::.Load(String)


SaveAs Method

[image] [image]

A Sandcastle Documented Class Library
DocX..::.SaveAs Method
DocX Class See Also Send Feedback

Overload List

Name | Description
SaveAs(Stream) | Save this document to a Stream.
SaveAs(String) | Save this document to a file.

See Also

DocX Class
DocX Members


SaveAs Method (Stream)

[image]

A Sandcastle Documented Class Library
DocX..::.SaveAs Method (Stream)
DocX Class Example See Also Send Feedback
Save this document to a Stream.

Namespace: Novacode
Assembly: DocX (in DocX.dll) Version: 1.0.0.7 (1.0.0.7)

Syntax

C#
public void SaveAs(
    Stream stream
)
Visual Basic (Declaration)
Public Sub SaveAs ( _
    stream As Stream _
)
Visual C++
public:
void SaveAs(
    Stream^ stream
)

Parameters

stream
Type: System.IO..::.Stream
The Stream to save this document to.

Examples

Load a document from a file and save it to a Stream.
CopyC#
// Place holder for a document.
DocX document;

using (FileStream fs1 = new FileStream(@"C:\Example\Test1.docx", FileMode.Open))
{
    // Load a document using a stream.
    document = DocX.Load(fs1);

    // Insert a new Paragraph
    document.InsertParagraph("Hello world again!", false);
}

using (FileStream fs2 = new FileStream(@"C:\Example\Test2.docx", FileMode.Create))
{
    // Save the document to a different stream.
    document.SaveAs(fs2);
}

// Release this document from memory.
document.Dispose();

Examples

Load a document from one Stream and save it to another.
CopyC#
DocX document;
using (FileStream fs1 = new FileStream(@"C:\Example\Test1.docx", FileMode.Open))
{
    // Load a document using a stream.
    document = DocX.Load(fs1);

    // Insert a new Paragraph
    document.InsertParagraph("Hello world again!", false);
}

using (FileStream fs2 = new FileStream(@"C:\Example\Test2.docx", FileMode.Create))
{
    // Save the document to a different stream.
    document.SaveAs(fs2);
}

See Also

DocX Class
SaveAs Overload
Novacode Namespace
DocX..::.Save()()()
DocX..::.Create(Stream)
DocX..::.Create(String)
DocX..::.Load(Stream)
DocX..::.Load(String)


SaveAs Method (String)

[image]

A Sandcastle Documented Class Library
DocX..::.SaveAs Method (String)
DocX Class Example See Also Send Feedback
Save this document to a file.

Namespace: Novacode
Assembly: DocX (in DocX.dll) Version: 1.0.0.7 (1.0.0.7)

Syntax

C#
public void SaveAs(
    string filename
)
Visual Basic (Declaration)
Public Sub SaveAs ( _
    filename As String _
)
Visual C++
public:
void SaveAs(
    String^ filename
)

Parameters

filename
Type: System..::.String
The filename to save this document as.

Examples

Load a document from one file and save it to another.
CopyC#
// Load a document using its fully qualified filename.
DocX document = DocX.Load(@"C:\Example\Test1.docx");

// Insert a new Paragraph
document.InsertParagraph("Hello world!", false);

// Save the document to a new location.
document.SaveAs(@"C:\Example\Test2.docx");

Examples

Load a document from a Stream and save it to a file.
CopyC#
DocX document;
using (FileStream fs1 = new FileStream(@"C:\Example\Test1.docx", FileMode.Open))
{
    // Load a document using a stream.
    document = DocX.Load(fs1);

    // Insert a new Paragraph
    document.InsertParagraph("Hello world again!", false);
}

// Save the document to a new location.
document.SaveAs(@"C:\Example\Test2.docx");

See Also

DocX Class
SaveAs Overload
Novacode Namespace
DocX..::.Save()()()
DocX..::.Create(Stream)
DocX..::.Create(String)
DocX..::.Load(Stream)
DocX..::.Load(String)


DocX Properties

[image] [image]

A Sandcastle Documented Class Library
DocX Properties
DocX Class See Also Send Feedback

The DocX type exposes the following members.

Properties

Name | Description
CustomProperties | Returns a list of custom properties in this document.
FooterText | Gets the concatenated text of all footer files in this document.
HeaderText | Gets the concatenated text of all header files in this document.
Images | Returns a list of Images in this document.
Paragraphs | Returns a list of Paragraphs in this document.
Tables | Returns a list of Tables in this Paragraph.
Text | Get the Text of this document.

See Also

DocX Class


CustomProperties Property

[image]

A Sandcastle Documented Class Library
DocX..::.CustomProperties Property
DocX Class Example See Also Send Feedback
Returns a list of custom properties in this document.

Namespace: Novacode
Assembly: DocX (in DocX.dll) Version: 1.0.0.7 (1.0.0.7)

Syntax

C#
public Dictionary<string, CustomProperty> CustomProperties { get; }
Visual Basic (Declaration)
Public ReadOnly Property CustomProperties As Dictionary(Of String, CustomProperty)
Visual C++
public:
property Dictionary<String^, CustomProperty^>^ CustomProperties {
    Dictionary<String^, CustomProperty^>^ get ();
}

Examples

Method 1: Get the name, type and value of each CustomProperty in this document.
CopyC#
// Load Example.docx
DocX document = DocX.Load(@"C:\Example\Test.docx");

/*
 * No two custom properties can have the same name,
 * so a Dictionary is the perfect data structure to store them in.
 * Each custom property can be accessed using its name.
 */
foreach (string name in document.CustomProperties.Keys)
{
    // Grab a custom property using its name.
    CustomProperty cp = document.CustomProperties[name];

    // Write this custom properties details to Console.
    Console.WriteLine(string.Format("Name: '{0}', Value: {1}", cp.Name, cp.Value));
}

Console.WriteLine("Press any key...");

// Wait for the user to press a key before closing the Console.
Console.ReadKey();

Examples

Method 2: Get the name, type and value of each CustomProperty in this document.
CopyC#
// Load Example.docx
DocX document = DocX.Load(@"C:\Example\Test.docx");

/*
 * No two custom properties can have the same name,
 * so a Dictionary is the perfect data structure to store them in.
 * The values of this Dictionary are CustomProperties.
 */
foreach (CustomProperty cp in document.CustomProperties.Values)
{
    // Write this custom properties details to Console.
    Console.WriteLine(string.Format("Name: '{0}', Value: {1}", cp.Name, cp.Value));
}

Console.WriteLine("Press any key...");

// Wait for the user to press a key before closing the Console.
Console.ReadKey();

See Also

DocX Class
Novacode Namespace
DocX..::.AddCustomProperty(CustomProperty)


FooterText Property

[image]

A Sandcastle Documented Class Library
DocX..::.FooterText Property
DocX Class See Also Send Feedback
Gets the concatenated text of all footer files in this document.

Namespace: Novacode
Assembly: DocX (in DocX.dll) Version: 1.0.0.7 (1.0.0.7)

Syntax

C#
public string FooterText { get; }
Visual Basic (Declaration)
Public ReadOnly Property FooterText As String
Visual C++
public:
property String^ FooterText {
    String^ get ();
}

See Also

DocX Class


HeaderText Property

[image]

A Sandcastle Documented Class Library
DocX..::.HeaderText Property
DocX Class See Also Send Feedback
Gets the concatenated text of all header files in this document.

Namespace: Novacode
Assembly: DocX (in DocX.dll) Version: 1.0.0.7 (1.0.0.7)

Syntax

C#
public string HeaderText { get; }
Visual Basic (Declaration)
Public ReadOnly Property HeaderText As String
Visual C++
public:
property String^ HeaderText {
    String^ get ();
}

See Also

DocX Class


Images Property

[image]

A Sandcastle Documented Class Library
DocX..::.Images Property
DocX Class Example See Also Send Feedback
Returns a list of Images in this document.

Namespace: Novacode
Assembly: DocX (in DocX.dll) Version: 1.0.0.7 (1.0.0.7)

Syntax

C#
public List<Image> Images { get; }
Visual Basic (Declaration)
Public ReadOnly Property Images As List(Of Image)
Visual C++
public:
property List<Image^>^ Images {
    List<Image^>^ get ();
}

Examples

Get the unique Id of every Image in this document.
CopyC#
// Load a document.
DocX document = DocX.Load(@"C:\Example\Test.docx");

// Loop through each Image in this document.
foreach (Novacode.Image i in document.Images)
{
    // Get the unique Id which identifies this Image.
    string uniqueId = i.Id;
}

See Also

DocX Class
Novacode Namespace
DocX..::.AddImage(String)
DocX..::.AddImage(Stream)
Paragraph..::.Pictures
Paragraph..::.InsertPicture(String, String, String)


Paragraphs Property

[image]

A Sandcastle Documented Class Library
DocX..::.Paragraphs Property
DocX Class Example See Also Send Feedback
Returns a list of Paragraphs in this document.

Namespace: Novacode
Assembly: DocX (in DocX.dll) Version: 1.0.0.7 (1.0.0.7)

Syntax

C#
public List<Paragraph> Paragraphs { get; }
Visual Basic (Declaration)
Public ReadOnly Property Paragraphs As List(Of Paragraph)
Visual C++
public:
property List<Paragraph^>^ Paragraphs {
    List<Paragraph^>^ get ();
}

Examples

Write to Console the Text from each Paragraph in this document.
CopyC#
// Load a document
DocX document = DocX.Load(@"C:\Example\Test.docx");

// Loop through each Paragraph in this document.
foreach (Paragraph p in document.Paragraphs)
{
    // Write this Paragraphs Text to Console.
    Console.WriteLine(p.Text);
}

// Wait for the user to press a key before closing the console window.
Console.ReadKey();

See Also

DocX Class
Novacode Namespace
Paragraph..::.InsertText(String, Boolean)
Paragraph..::.InsertText(Int32, String, Boolean)
Paragraph..::.InsertText(String, Boolean, Formatting)
Paragraph..::.InsertText(Int32, String, Boolean, Formatting)
Paragraph..::.RemoveText(Int32, Boolean)
Paragraph..::.RemoveText(Int32, Int32, Boolean)
Paragraph..::.ReplaceText(String, String, Boolean)
Paragraph..::.ReplaceText(String, String, Boolean, RegexOptions)
Paragraph..::.InsertPicture(String, String, String)


Tables Property

[image]

A Sandcastle Documented Class Library
DocX..::.Tables Property
DocX Class See Also Send Feedback
Returns a list of Tables in this Paragraph.

Namespace: Novacode
Assembly: DocX (in DocX.dll) Version: 1.0.0.7 (1.0.0.7)

Syntax

C#
public List<Table> Tables { get; }
Visual Basic (Declaration)
Public ReadOnly Property Tables As List(Of Table)
Visual C++
public:
property List<Table^>^ Tables {
    List<Table^>^ get ();
}

See Also

DocX Class


Text Property

[image]

A Sandcastle Documented Class Library
DocX..::.Text Property
DocX Class Example See Also Send Feedback
Get the Text of this document.

Namespace: Novacode
Assembly: DocX (in DocX.dll) Version: 1.0.0.7 (1.0.0.7)

Syntax

C#
public string Text { get; }
Visual Basic (Declaration)
Public ReadOnly Property Text As String
Visual C++
public:
property String^ Text {
    String^ get ();
}

Examples

Write to Console the Text from this document.
CopyC#
// Load a document
DocX document = DocX.Load(@"C:\Example\Test.docx");

// Get the text of this document.
string text = document.Text;

// Write the text of this document to Console.
Console.Write(text);

// Wait for the user to press a key before closing the console window.
Console.ReadKey();

See Also

DocX Class


EquationShapes Enumeration

[image]

A Sandcastle Documented Class Library
EquationShapes Enumeration
See Also Send Feedback

[Missing <summary> documentation for "T:Novacode.EquationShapes"]

Namespace: Novacode
Assembly: DocX (in DocX.dll) Version: 1.0.0.7 (1.0.0.7)

Syntax

C#
public enum EquationShapes
Visual Basic (Declaration)
Public Enumeration EquationShapes
Visual C++
public enum class EquationShapes

Members

Member name | Description
mathPlus |
mathMinus |
mathMultiply |
mathDivide |
mathEqual |
mathNotEqual |

See Also

Novacode Namespace


FlowchartShapes Enumeration

[image]

A Sandcastle Documented Class Library
FlowchartShapes Enumeration
See Also Send Feedback

[Missing <summary> documentation for "T:Novacode.FlowchartShapes"]

Namespace: Novacode
Assembly: DocX (in DocX.dll) Version: 1.0.0.7 (1.0.0.7)

Syntax

C#
public enum FlowchartShapes
Visual Basic (Declaration)
Public Enumeration FlowchartShapes
Visual C++
public enum class FlowchartShapes

Members

Member name | Description
flowChartProcess |
flowChartAlternateProcess |
flowChartDecision |
flowChartInputOutput |
flowChartPredefinedProcess |
flowChartInternalStorage |
flowChartDocument |
flowChartMultidocument |
flowChartTerminator |
flowChartPreparation |
flowChartManualInput |
flowChartManualOperation |
flowChartConnector |
flowChartOffpageConnector |
flowChartPunchedCard |
flowChartPunchedTape |
flowChartSummingJunction |
flowChartOr |
flowChartCollate |
flowChartSort |
flowChartExtract |
flowChartMerge |
flowChartOnlineStorage |
flowChartDelay |
flowChartMagneticTape |
flowChartMagneticDisk |
flowChartMagneticDrum |
flowChartDisplay |

See Also

Novacode Namespace


Formatting Class

[image]

A Sandcastle Documented Class Library
Formatting Class
Members See Also Send Feedback
A text formatting.

Namespace: Novacode
Assembly: DocX (in DocX.dll) Version: 1.0.0.7 (1.0.0.7)

Syntax

C#
public class Formatting
Visual Basic (Declaration)
Public Class Formatting
Visual C++
public ref class Formatting

Inheritance Hierarchy

System..::.Object
Novacode..::.Formatting

See Also

Formatting Members


Formatting Members

[image] [image]

A Sandcastle Documented Class Library
Formatting Members
Formatting Class Constructors Properties See Also Send Feedback

The Formatting type exposes the following members.

Constructors

Name | Description
Formatting | A text formatting.

Properties

Name | Description
Bold | This formatting will apply Bold.
CapsStyle | Capitalization style.
FontColor | The colour of the text.
FontFamily | The font familt of this formatting.
Hidden | Is this text hidden or visible.
Highlight | Highlight colour.
Italic | This formatting will apply Italic.
Kerning | The Kerning to apply to this text must be one of the following values 8, 9, 10, 11, 12, 14, 16, 18, 20, 22, 24, 26, 28, 36, 48, 72.
Misc | Misc settings.
PercentageScale | Percentage scale must be one of the following values 200, 150, 100, 90, 80, 66, 50 or 33.
Position | Text position must be in the range (-1585 - 1585).
Script | The script that this formatting should be, normal, superscript or subscript.
Size | The Size of this text, must be between 0 and 1638.
Spacing | Text spacing must be in the range (-1585 - 1585).
StrikeThrough | This formatting will apply StrickThrough.
UnderlineColor | The underline colour.
UnderlineStyle | The Underline style that this formatting applies.

See Also

Formatting Class


Formatting Constructor

[image]

A Sandcastle Documented Class Library
Formatting Constructor
Formatting Class See Also Send Feedback
A text formatting.

Namespace: Novacode
Assembly: DocX (in DocX.dll) Version: 1.0.0.7 (1.0.0.7)

Syntax

C#
public Formatting()
Visual Basic (Declaration)
Public Sub New
Visual C++
public:
Formatting()

See Also

Formatting Class


Formatting Properties

[image] [image]

A Sandcastle Documented Class Library
Formatting Properties
Formatting Class See Also Send Feedback

The Formatting type exposes the following members.

Properties

Name | Description
Bold | This formatting will apply Bold.
CapsStyle | Capitalization style.
FontColor | The colour of the text.
FontFamily | The font familt of this formatting.
Hidden | Is this text hidden or visible.
Highlight | Highlight colour.
Italic | This formatting will apply Italic.
Kerning | The Kerning to apply to this text must be one of the following values 8, 9, 10, 11, 12, 14, 16, 18, 20, 22, 24, 26, 28, 36, 48, 72.
Misc | Misc settings.
PercentageScale | Percentage scale must be one of the following values 200, 150, 100, 90, 80, 66, 50 or 33.
Position | Text position must be in the range (-1585 - 1585).
Script | The script that this formatting should be, normal, superscript or subscript.
Size | The Size of this text, must be between 0 and 1638.
Spacing | Text spacing must be in the range (-1585 - 1585).
StrikeThrough | This formatting will apply StrickThrough.
UnderlineColor | The underline colour.
UnderlineStyle | The Underline style that this formatting applies.

See Also

Formatting Class


Bold Property

[image]

A Sandcastle Documented Class Library
Formatting..::.Bold Property
Formatting Class See Also Send Feedback
This formatting will apply Bold.

Namespace: Novacode
Assembly: DocX (in DocX.dll) Version: 1.0.0.7 (1.0.0.7)

Syntax

C#
public bool Bold { get; set; }
Visual Basic (Declaration)
Public Property Bold As Boolean
Visual C++
public:
property bool Bold {
    bool get ();
    void set (bool value);
}

See Also

Formatting Class


CapsStyle Property

[image]

A Sandcastle Documented Class Library
Formatting..::.CapsStyle Property
Formatting Class See Also Send Feedback
Capitalization style.

Namespace: Novacode
Assembly: DocX (in DocX.dll) Version: 1.0.0.7 (1.0.0.7)

Syntax

C#
public CapsStyle CapsStyle { get; set; }
Visual Basic (Declaration)
Public Property CapsStyle As CapsStyle
Visual C++
public:
property CapsStyle CapsStyle {
    CapsStyle get ();
    void set (CapsStyle value);
}

See Also

Formatting Class


FontColor Property

[image]

A Sandcastle Documented Class Library
Formatting..::.FontColor Property
Formatting Class See Also Send Feedback
The colour of the text.

Namespace: Novacode
Assembly: DocX (in DocX.dll) Version: 1.0.0.7 (1.0.0.7)

Syntax

C#
public Nullable<Color> FontColor { get; set; }
Visual Basic (Declaration)
Public Property FontColor As Nullable(Of Color)
Visual C++
public:
property Nullable<Color> FontColor {
    Nullable<Color> get ();
    void set (Nullable<Color> value);
}

See Also

Formatting Class


FontFamily Property

[image]

A Sandcastle Documented Class Library
Formatting..::.FontFamily Property
Formatting Class See Also Send Feedback
The font familt of this formatting.

Namespace: Novacode
Assembly: DocX (in DocX.dll) Version: 1.0.0.7 (1.0.0.7)

Syntax

C#
public FontFamily FontFamily { get; set; }
Visual Basic (Declaration)
Public Property FontFamily As FontFamily
Visual C++
public:
property FontFamily^ FontFamily {
    FontFamily^ get ();
    void set (FontFamily^ value);
}

See Also

Formatting Class


Hidden Property

[image]

A Sandcastle Documented Class Library
Formatting..::.Hidden Property
Formatting Class See Also Send Feedback
Is this text hidden or visible.

Namespace: Novacode
Assembly: DocX (in DocX.dll) Version: 1.0.0.7 (1.0.0.7)

Syntax

C#
public bool Hidden { get; set; }
Visual Basic (Declaration)
Public Property Hidden As Boolean
Visual C++
public:
property bool Hidden {
    bool get ();
    void set (bool value);
}

See Also

Formatting Class


Highlight Property

[image]

A Sandcastle Documented Class Library
Formatting..::.Highlight Property
Formatting Class See Also Send Feedback
Highlight colour.

Namespace: Novacode
Assembly: DocX (in DocX.dll) Version: 1.0.0.7 (1.0.0.7)

Syntax

C#
public Highlight Highlight { get; set; }
Visual Basic (Declaration)
Public Property Highlight As Highlight
Visual C++
public:
property Highlight Highlight {
    Highlight get ();
    void set (Highlight value);
}

See Also

Formatting Class


Italic Property

[image]

A Sandcastle Documented Class Library
Formatting..::.Italic Property
Formatting Class See Also Send Feedback
This formatting will apply Italic.

Namespace: Novacode
Assembly: DocX (in DocX.dll) Version: 1.0.0.7 (1.0.0.7)

Syntax

C#
public bool Italic { get; set; }
Visual Basic (Declaration)
Public Property Italic As Boolean
Visual C++
public:
property bool Italic {
    bool get ();
    void set (bool value);
}

See Also

Formatting Class


Kerning Property

[image]

A Sandcastle Documented Class Library
Formatting..::.Kerning Property
Formatting Class See Also Send Feedback
The Kerning to apply to this text must be one of the following values 8, 9, 10, 11, 12, 14, 16, 18, 20, 22, 24, 26, 28, 36, 48, 72.

Namespace: Novacode
Assembly: DocX (in DocX.dll) Version: 1.0.0.7 (1.0.0.7)

Syntax

C#
public Nullable<int> Kerning { get; set; }
Visual Basic (Declaration)
Public Property Kerning As Nullable(Of Integer)
Visual C++
public:
property Nullable<int> Kerning {
    Nullable<int> get ();
    void set (Nullable<int> value);
}

See Also

Formatting Class


Misc Property

[image]

A Sandcastle Documented Class Library
Formatting..::.Misc Property
Formatting Class See Also Send Feedback
Misc settings.

Namespace: Novacode
Assembly: DocX (in DocX.dll) Version: 1.0.0.7 (1.0.0.7)

Syntax

C#
public Misc Misc { get; set; }
Visual Basic (Declaration)
Public Property Misc As Misc
Visual C++
public:
property Misc Misc {
    Misc get ();
    void set (Misc value);
}

See Also

Formatting Class


PercentageScale Property

[image]

A Sandcastle Documented Class Library
Formatting..::.PercentageScale Property
Formatting Class See Also Send Feedback
Percentage scale must be one of the following values 200, 150, 100, 90, 80, 66, 50 or 33.

Namespace: Novacode
Assembly: DocX (in DocX.dll) Version: 1.0.0.7 (1.0.0.7)

Syntax

C#
public Nullable<int> PercentageScale { get; set; }
Visual Basic (Declaration)
Public Property PercentageScale As Nullable(Of Integer)
Visual C++
public:
property Nullable<int> PercentageScale {
    Nullable<int> get ();
    void set (Nullable<int> value);
}

See Also

Formatting Class


Position Property

[image]

A Sandcastle Documented Class Library
Formatting..::.Position Property
Formatting Class See Also Send Feedback
Text position must be in the range (-1585 - 1585).

Namespace: Novacode
Assembly: DocX (in DocX.dll) Version: 1.0.0.7 (1.0.0.7)

Syntax

C#
public Nullable<int> Position { get; set; }
Visual Basic (Declaration)
Public Property Position As Nullable(Of Integer)
Visual C++
public:
property Nullable<int> Position {
    Nullable<int> get ();
    void set (Nullable<int> value);
}

See Also

Formatting Class


Script Property

[image]

A Sandcastle Documented Class Library
Formatting..::.Script Property
Formatting Class See Also Send Feedback
The script that this formatting should be, normal, superscript or subscript.

Namespace: Novacode
Assembly: DocX (in DocX.dll) Version: 1.0.0.7 (1.0.0.7)

Syntax

C#
public Script Script { get; set; }
Visual Basic (Declaration)
Public Property Script As Script
Visual C++
public:
property Script Script {
    Script get ();
    void set (Script value);
}

See Also

Formatting Class


Size Property

[image]

A Sandcastle Documented Class Library
Formatting..::.Size Property
Formatting Class See Also Send Feedback
The Size of this text, must be between 0 and 1638.

Namespace: Novacode
Assembly: DocX (in DocX.dll) Version: 1.0.0.7 (1.0.0.7)

Syntax

C#
public Nullable<double> Size { get; set; }
Visual Basic (Declaration)
Public Property Size As Nullable(Of Double)
Visual C++
public:
property Nullable<double> Size {
    Nullable<double> get ();
    void set (Nullable<double> value);
}

See Also

Formatting Class


Spacing Property

[image]

A Sandcastle Documented Class Library
Formatting..::.Spacing Property
Formatting Class See Also Send Feedback
Text spacing must be in the range (-1585 - 1585).

Namespace: Novacode
Assembly: DocX (in DocX.dll) Version: 1.0.0.7 (1.0.0.7)

Syntax

C#
public Nullable<double> Spacing { get; set; }
Visual Basic (Declaration)
Public Property Spacing As Nullable(Of Double)
Visual C++
public:
property Nullable<double> Spacing {
    Nullable<double> get ();
    void set (Nullable<double> value);
}

See Also

Formatting Class


StrikeThrough Property

[image]

A Sandcastle Documented Class Library
Formatting..::.StrikeThrough Property
Formatting Class See Also Send Feedback
This formatting will apply StrickThrough.

Namespace: Novacode
Assembly: DocX (in DocX.dll) Version: 1.0.0.7 (1.0.0.7)

Syntax

C#
public StrikeThrough StrikeThrough { get; set; }
Visual Basic (Declaration)
Public Property StrikeThrough As StrikeThrough
Visual C++
public:
property StrikeThrough StrikeThrough {
    StrikeThrough get ();
    void set (StrikeThrough value);
}

See Also

Formatting Class


UnderlineColor Property

[image]

A Sandcastle Documented Class Library
Formatting..::.UnderlineColor Property
Formatting Class See Also Send Feedback
The underline colour.

Namespace: Novacode
Assembly: DocX (in DocX.dll) Version: 1.0.0.7 (1.0.0.7)

Syntax

C#
public Nullable<Color> UnderlineColor { get; set; }
Visual Basic (Declaration)
Public Property UnderlineColor As Nullable(Of Color)
Visual C++
public:
property Nullable<Color> UnderlineColor {
    Nullable<Color> get ();
    void set (Nullable<Color> value);
}

See Also

Formatting Class


UnderlineStyle Property

[image]

A Sandcastle Documented Class Library
Formatting..::.UnderlineStyle Property
Formatting Class See Also Send Feedback
The Underline style that this formatting applies.

Namespace: Novacode
Assembly: DocX (in DocX.dll) Version: 1.0.0.7 (1.0.0.7)

Syntax

C#
public UnderlineStyle UnderlineStyle { get; set; }
Visual Basic (Declaration)
Public Property UnderlineStyle As UnderlineStyle
Visual C++
public:
property UnderlineStyle UnderlineStyle {
    UnderlineStyle get ();
    void set (UnderlineStyle value);
}

See Also

Formatting Class


Highlight Enumeration

[image]

A Sandcastle Documented Class Library
Highlight Enumeration
See Also Send Feedback

[Missing <summary> documentation for "T:Novacode.Highlight"]

Namespace: Novacode
Assembly: DocX (in DocX.dll) Version: 1.0.0.7 (1.0.0.7)

Syntax

C#
public enum Highlight
Visual Basic (Declaration)
Public Enumeration Highlight
Visual C++
public enum class Highlight

Members

Member name | Description
yellow |
green |
cyan |
magenta |
blue |
red |
darkBlue |
darkCyan |
darkGreen |
darkMagenta |
darkRed |
darkYellow |
darkGray |
lightGray |
black |
none |

See Also

Novacode Namespace


Image Class

[image]

A Sandcastle Documented Class Library
Image Class
Members See Also Send Feedback
Represents an Image embedded in a document.

Namespace: Novacode
Assembly: DocX (in DocX.dll) Version: 1.0.0.7 (1.0.0.7)

Syntax

C#
public class Image
Visual Basic (Declaration)
Public Class Image
Visual C++
public ref class Image

Inheritance Hierarchy

System..::.Object
Novacode..::.Image

See Also

Image Members


Image Members

[image] [image]

A Sandcastle Documented Class Library
Image Members
Image Class Properties See Also Send Feedback

The Image type exposes the following members.

Properties

Name | Description
Id | Returns the id of this Image.

See Also

Image Class


Image Properties

[image] [image]

A Sandcastle Documented Class Library
Image Properties
Image Class See Also Send Feedback

The Image type exposes the following members.

Properties

Name | Description
Id | Returns the id of this Image.

See Also

Image Class


Id Property

[image]

A Sandcastle Documented Class Library
Image..::.Id Property
Image Class See Also Send Feedback
Returns the id of this Image.

Namespace: Novacode
Assembly: DocX (in DocX.dll) Version: 1.0.0.7 (1.0.0.7)

Syntax

C#
public string Id { get; }
Visual Basic (Declaration)
Public ReadOnly Property Id As String
Visual C++
public:
property String^ Id {
    String^ get ();
}

See Also

Image Class


MatchFormattingOptions Enumeration

[image]

A Sandcastle Documented Class Library
MatchFormattingOptions Enumeration
See Also Send Feedback

[Missing <summary> documentation for "T:Novacode.MatchFormattingOptions"]

Namespace: Novacode
Assembly: DocX (in DocX.dll) Version: 1.0.0.7 (1.0.0.7)

Syntax

C#
public enum MatchFormattingOptions
Visual Basic (Declaration)
Public Enumeration MatchFormattingOptions
Visual C++
public enum class MatchFormattingOptions

Members

Member name | Description
ExactMatch |
SubsetMatch |

See Also

Novacode Namespace


Misc Enumeration

[image]

A Sandcastle Documented Class Library
Misc Enumeration
See Also Send Feedback

[Missing <summary> documentation for "T:Novacode.Misc"]

Namespace: Novacode
Assembly: DocX (in DocX.dll) Version: 1.0.0.7 (1.0.0.7)

Syntax

C#
public enum Misc
Visual Basic (Declaration)
Public Enumeration Misc
Visual C++
public enum class Misc

Members

Member name | Description
none |
shadow |
outline |
outlineShadow |
emboss |
engrave |

See Also

Novacode Namespace


Paragraph Class

[image]

A Sandcastle Documented Class Library
Paragraph Class
Members See Also Send Feedback
Represents a document paragraph.

Namespace: Novacode
Assembly: DocX (in DocX.dll) Version: 1.0.0.7 (1.0.0.7)

Syntax

C#
public class Paragraph
Visual Basic (Declaration)
Public Class Paragraph
Visual C++
public ref class Paragraph

Inheritance Hierarchy

System..::.Object
Novacode..::.Paragraph

See Also

Paragraph Members


Paragraph Members

[image] [image]

A Sandcastle Documented Class Library
Paragraph Members
Paragraph Class Methods Properties See Also Send Feedback

The Paragraph type exposes the following members.

Methods

Name | Description
Append | Append text to this Paragraph.
AppendLine | Append text on a new line to this Paragraph.
Bold | For use with Append() and AppendLine()
CapsStyle | For use with Append() and AppendLine()
Color | For use with Append() and AppendLine()
FindAll | Overloaded.
Font | For use with Append() and AppendLine()
FontSize | For use with Append() and AppendLine()
Hide | For use with Append() and AppendLine()
Highlight | For use with Append() and AppendLine()
InsertDocProperty | Overloaded.
InsertPageBreakAfterSelf | Insert a page break after a Paragraph.
InsertPageBreakBeforeSelf | Insert a page break before a Paragraph.
InsertParagraphAfterSelf | Overloaded.
InsertParagraphBeforeSelf | Overloaded.
InsertPicture | Overloaded.
InsertTableAfterSelf | Overloaded.
InsertTableBeforeSelf | Overloaded.
InsertText | Overloaded.
Italic | For use with Append() and AppendLine()
Kerning |
Misc | For use with Append() and AppendLine()
PercentageScale |
Position |
Remove | Remove this Paragraph from the document.
RemoveText | Overloaded.
ReplaceText | Overloaded.
Script | For use with Append() and AppendLine()
Spacing |
StrikeThrough | For use with Append() and AppendLine()
UnderlineColor | For use with Append() and AppendLine()
UnderlineStyle | For use with Append() and AppendLine()

Properties

Name | Description
Alignment | Gets or set this Paragraphs text alignment.
DocumentProperties | Returns a list of field type DocProperty in this document.
Pictures | Returns a list of Pictures in this Paragraph.
Text | Gets the text value of this Paragraph.

See Also

Paragraph Class


Paragraph Methods

[image] [image]

A Sandcastle Documented Class Library
Paragraph Methods
Paragraph Class See Also Send Feedback

The Paragraph type exposes the following members.

Methods

Name | Description
Append | Append text to this Paragraph.
AppendLine | Append text on a new line to this Paragraph.
Bold | For use with Append() and AppendLine()
CapsStyle | For use with Append() and AppendLine()
Color | For use with Append() and AppendLine()
FindAll | Overloaded.
Font | For use with Append() and AppendLine()
FontSize | For use with Append() and AppendLine()
Hide | For use with Append() and AppendLine()
Highlight | For use with Append() and AppendLine()
InsertDocProperty | Overloaded.
InsertPageBreakAfterSelf | Insert a page break after a Paragraph.
InsertPageBreakBeforeSelf | Insert a page break before a Paragraph.
InsertParagraphAfterSelf | Overloaded.
InsertParagraphBeforeSelf | Overloaded.
InsertPicture | Overloaded.
InsertTableAfterSelf | Overloaded.
InsertTableBeforeSelf | Overloaded.
InsertText | Overloaded.
Italic | For use with Append() and AppendLine()
Kerning |
Misc | For use with Append() and AppendLine()
PercentageScale |
Position |
Remove | Remove this Paragraph from the document.
RemoveText | Overloaded.
ReplaceText | Overloaded.
Script | For use with Append() and AppendLine()
Spacing |
StrikeThrough | For use with Append() and AppendLine()
UnderlineColor | For use with Append() and AppendLine()
UnderlineStyle | For use with Append() and AppendLine()

See Also

Paragraph Class


Append Method

[image]

A Sandcastle Documented Class Library
Paragraph..::.Append Method
Paragraph Class Example See Also Send Feedback
Append text to this Paragraph.

Namespace: Novacode
Assembly: DocX (in DocX.dll) Version: 1.0.0.7 (1.0.0.7)

Syntax

C#
public Paragraph Append(
    string text
)
Visual Basic (Declaration)
Public Function Append ( _
    text As String _
) As Paragraph
Visual C++
public:
Paragraph^ Append(
    String^ text
)

Parameters

text
Type: System..::.String
The text to append.

Return Value

This Paragraph with the new text appened.

Examples

Add a new Paragraph to this document and then append some text to it.
CopyC#
// Load a document.
using (DocX document = DocX.Create(@"Test.docx"))
{
    // Insert a new Paragraph and Append some text to it.
    Paragraph p = document.InsertParagraph().Append("Hello World!!!");

    // Save this document.
    document.Save();
}

See Also

Paragraph Class


AppendLine Method

[image]

A Sandcastle Documented Class Library
Paragraph..::.AppendLine Method
Paragraph Class Example See Also Send Feedback
Append text on a new line to this Paragraph.

Namespace: Novacode
Assembly: DocX (in DocX.dll) Version: 1.0.0.7 (1.0.0.7)

Syntax

C#
public Paragraph AppendLine(
    string text
)
Visual Basic (Declaration)
Public Function AppendLine ( _
    text As String _
) As Paragraph
Visual C++
public:
Paragraph^ AppendLine(
    String^ text
)

Parameters

text
Type: System..::.String
The text to append.

Return Value

This Paragraph with the new text appened.

Examples

Add a new Paragraph to this document and then append a new line with some text to it.
CopyC#
// Load a document.
using (DocX document = DocX.Create(@"Test.docx"))
{
    // Insert a new Paragraph and Append a new line with some text to it.
    Paragraph p = document.InsertParagraph().AppendLine("Hello World!!!");

    // Save this document.
    document.Save();
}

See Also

Paragraph Class


Bold Method

[image]

A Sandcastle Documented Class Library
Paragraph..::.Bold Method
Paragraph Class Example See Also Send Feedback
For use with Append() and AppendLine()

Namespace: Novacode
Assembly: DocX (in DocX.dll) Version: 1.0.0.7 (1.0.0.7)

Syntax

C#
public Paragraph Bold()
Visual Basic (Declaration)
Public Function Bold As Paragraph
Visual C++
public:
Paragraph^ Bold()

Return Value

This Paragraph with the last appended text bold.

Examples

Append text to this Paragraph and then make it bold.
CopyC#
// Create a document.
using (DocX document = DocX.Create(@"Test.docx"))
{
    // Insert a new Paragraph.
    Paragraph p = document.InsertParagraph();

    p.Append("I am ")
    .Append("Bold").Bold()
    .Append(" I am not");

    // Save this document.
    document.Save();
}// Release this document from memory.

See Also

Paragraph Class


CapsStyle Method

[image]

A Sandcastle Documented Class Library
Paragraph..::.CapsStyle Method
Paragraph Class Example See Also Send Feedback
For use with Append() and AppendLine()

Namespace: Novacode
Assembly: DocX (in DocX.dll) Version: 1.0.0.7 (1.0.0.7)

Syntax

C#
public Paragraph CapsStyle(
    CapsStyle capsStyle
)
Visual Basic (Declaration)
Public Function CapsStyle ( _
    capsStyle As CapsStyle _
) As Paragraph
Visual C++
public:
Paragraph^ CapsStyle(
    CapsStyle capsStyle
)

Parameters

capsStyle
Type: Novacode..::.CapsStyle
The caps style to apply to the last appended text.

Return Value

This Paragraph with the last appended text's caps style changed.

Examples

Append text to this Paragraph and then set it to full caps.
CopyC#
// Create a document.
using (DocX document = DocX.Create(@"Test.docx"))
{
    // Insert a new Paragraph.
    Paragraph p = document.InsertParagraph();

    p.Append("I am ")
    .Append("Capitalized").CapsStyle(CapsStyle.caps)
    .Append(" I am not");

    // Save this document.
    document.Save();
}// Release this document from memory.

See Also

Paragraph Class


Color Method

[image]

A Sandcastle Documented Class Library
Paragraph..::.Color Method
Paragraph Class Example See Also Send Feedback
For use with Append() and AppendLine()

Namespace: Novacode
Assembly: DocX (in DocX.dll) Version: 1.0.0.7 (1.0.0.7)

Syntax

C#
public Paragraph Color(
    Color c
)
Visual Basic (Declaration)
Public Function Color ( _
    c As Color _
) As Paragraph
Visual C++
public:
Paragraph^ Color(
    Color c
)

Parameters

c
Type: System.Drawing..::.Color
A color to use on the appended text.

Return Value

This Paragraph with the last appended text colored.

Examples

Append text to this Paragraph and then color it.
CopyC#
// Create a document.
using (DocX document = DocX.Create(@"Test.docx"))
{
    // Insert a new Paragraph.
    Paragraph p = document.InsertParagraph();

    p.Append("I am ")
    .Append("Blue").Color(Color.Blue)
    .Append(" I am not");

    // Save this document.
    document.Save();
}// Release this document from memory.

See Also

Paragraph Class


FindAll Method

[image] [image]

A Sandcastle Documented Class Library
Paragraph..::.FindAll Method
Paragraph Class See Also Send Feedback

Overload List

Name | Description
FindAll(String) | Find all instances of a string in this paragraph and return their indexes in a List.
FindAll(String, RegexOptions) | Find all instances of a string in this paragraph and return their indexes in a List.

See Also

Paragraph Class
Paragraph Members


FindAll Method (String)

[image]

A Sandcastle Documented Class Library
Paragraph..::.FindAll Method (String)
Paragraph Class Example See Also Send Feedback
Find all instances of a string in this paragraph and return their indexes in a List.

Namespace: Novacode
Assembly: DocX (in DocX.dll) Version: 1.0.0.7 (1.0.0.7)

Syntax

C#
public List<int> FindAll(
    string str
)
Visual Basic (Declaration)
Public Function FindAll ( _
    str As String _
) As List(Of Integer)
Visual C++
public:
List<int>^ FindAll(
    String^ str
)

Parameters

str
Type: System..::.String
The string to find

Return Value

A list of indexes.

Examples

Find all instances of Hello in this document and insert 'don't' in frount of them.
CopyC#
// Load a document
using (DocX document = DocX.Load(@"Test.docx"))
{
    // Loop through the paragraphs in this document.
    foreach(Paragraph p in document.Paragraphs)
    {
        // Find all instances of 'go' in this paragraph.
        List<int> gos = document.FindAll("go");

        /*
         * Insert 'don't' in frount of every instance of 'go' in this document to produce 'don't go'.
         * An important trick here is to do the inserting in reverse document order. If you inserted
         * in document order, every insert would shift the index of the remaining matches.
         */
        gos.Reverse();
        foreach (int index in gos)
        {
            p.InsertText(index, "don't ", false);
        }
    }

    // Save all changes made to this document.
    document.Save();
}// Release this document from memory.

See Also

Paragraph Class
FindAll Overload


FindAll Method (String, RegexOptions)

[image]

A Sandcastle Documented Class Library
Paragraph..::.FindAll Method (String, RegexOptions)
Paragraph Class Example See Also Send Feedback
Find all instances of a string in this paragraph and return their indexes in a List.

Namespace: Novacode
Assembly: DocX (in DocX.dll) Version: 1.0.0.7 (1.0.0.7)

Syntax

C#
public List<int> FindAll(
    string str,
    RegexOptions options
)
Visual Basic (Declaration)
Public Function FindAll ( _
    str As String, _
    options As RegexOptions _
) As List(Of Integer)
Visual C++
public:
List<int>^ FindAll(
    String^ str,
    RegexOptions options
)

Parameters

str
Type: System..::.String
The string to find
options
Type: System.Text.RegularExpressions..::.RegexOptions
The options to use when finding a string match.

Return Value

A list of indexes.

Examples

Find all instances of Hello in this document and insert 'don't' in frount of them.
CopyC#
// Load a document
using (DocX document = DocX.Load(@"Test.docx"))
{
    // Loop through the paragraphs in this document.
    foreach(Paragraph p in document.Paragraphs)
    {
        // Find all instances of 'go' in this paragraph (Ignore case).
        List<int> gos = document.FindAll("go", RegexOptions.IgnoreCase);

        /*
         * Insert 'don't' in frount of every instance of 'go' in this document to produce 'don't go'.
         * An important trick here is to do the inserting in reverse document order. If you inserted
         * in document order, every insert would shift the index of the remaining matches.
         */
        gos.Reverse();
        foreach (int index in gos)
        {
            p.InsertText(index, "don't ", false);
        }
    }

    // Save all changes made to this document.
    document.Save();
}// Release this document from memory.

See Also

Paragraph Class
FindAll Overload


Font Method

[image]

A Sandcastle Documented Class Library
Paragraph..::.Font Method
Paragraph Class Example See Also Send Feedback
For use with Append() and AppendLine()

Namespace: Novacode
Assembly: DocX (in DocX.dll) Version: 1.0.0.7 (1.0.0.7)

Syntax

C#
public Paragraph Font(
    FontFamily fontFamily
)
Visual Basic (Declaration)
Public Function Font ( _
    fontFamily As FontFamily _
) As Paragraph
Visual C++
public:
Paragraph^ Font(
    FontFamily^ fontFamily
)

Parameters

fontFamily
Type: System.Drawing..::.FontFamily
The font to use for the appended text.

Return Value

This Paragraph with the last appended text's font changed.

Examples

Append text to this Paragraph and then change its font.
CopyC#
// Create a document.
using (DocX document = DocX.Create(@"Test.docx"))
{
    // Insert a new Paragraph.
    Paragraph p = document.InsertParagraph();

    p.Append("I am ")
    .Append("Times new roman").Font(new FontFamily("Times new roman"))
    .Append(" I am not");

    // Save this document.
    document.Save();
}// Release this document from memory.

See Also

Paragraph Class


FontSize Method

[image]

A Sandcastle Documented Class Library
Paragraph..::.FontSize Method
Paragraph Class Example See Also Send Feedback
For use with Append() and AppendLine()

Namespace: Novacode
Assembly: DocX (in DocX.dll) Version: 1.0.0.7 (1.0.0.7)

Syntax

C#
public Paragraph FontSize(
    double fontSize
)
Visual Basic (Declaration)
Public Function FontSize ( _
    fontSize As Double _
) As Paragraph
Visual C++
public:
Paragraph^ FontSize(
    double fontSize
)

Parameters

fontSize
Type: System..::.Double
The font size to use for the appended text.

Return Value

This Paragraph with the last appended text resized.

Examples

Append text to this Paragraph and then resize it.
CopyC#
// Create a document.
using (DocX document = DocX.Create(@"Test.docx"))
{
    // Insert a new Paragraph.
    Paragraph p = document.InsertParagraph();

    p.Append("I am ")
    .Append("Big").FontSize(20)
    .Append(" I am not");

    // Save this document.
    document.Save();
}// Release this document from memory.

See Also

Paragraph Class


Hide Method

[image]

A Sandcastle Documented Class Library
Paragraph..::.Hide Method
Paragraph Class Example See Also Send Feedback
For use with Append() and AppendLine()

Namespace: Novacode
Assembly: DocX (in DocX.dll) Version: 1.0.0.7 (1.0.0.7)

Syntax

C#
public Paragraph Hide()
Visual Basic (Declaration)
Public Function Hide As Paragraph
Visual C++
public:
Paragraph^ Hide()

Return Value

This Paragraph with the last appended text hidden.

Examples

Append text to this Paragraph and then hide it.
CopyC#
// Create a document.
using (DocX document = DocX.Create(@"Test.docx"))
{
    // Insert a new Paragraph.
    Paragraph p = document.InsertParagraph();

    p.Append("I am ")
    .Append("hidden").Hide()
    .Append(" I am not");

    // Save this document.
    document.Save();
}// Release this document from memory.

See Also

Paragraph Class


Highlight Method

[image]

A Sandcastle Documented Class Library
Paragraph..::.Highlight Method
Paragraph Class Example See Also Send Feedback
For use with Append() and AppendLine()

Namespace: Novacode
Assembly: DocX (in DocX.dll) Version: 1.0.0.7 (1.0.0.7)

Syntax

C#
public Paragraph Highlight(
    Highlight highlight
)
Visual Basic (Declaration)
Public Function Highlight ( _
    highlight As Highlight _
) As Paragraph
Visual C++
public:
Paragraph^ Highlight(
    Highlight highlight
)

Parameters

highlight
Type: Novacode..::.Highlight
The highlight to apply to the last appended text.

Return Value

This Paragraph with the last appended text highlighted.

Examples

Append text to this Paragraph and then highlight it.
CopyC#
// Create a document.
using (DocX document = DocX.Create(@"Test.docx"))
{
    // Insert a new Paragraph.
    Paragraph p = document.InsertParagraph();

    p.Append("I am ")
    .Append("highlighted").Highlight(Highlight.green)
    .Append(" I am not");

    // Save this document.
    document.Save();
}// Release this document from memory.

See Also

Paragraph Class


InsertDocProperty Method

[image] [image]

A Sandcastle Documented Class Library
Paragraph..::.InsertDocProperty Method
Paragraph Class See Also Send Feedback

Overload List

Name | Description
InsertDocProperty(CustomProperty) | Insert a field of type document property, this field will display the custom property cp, at the end of this paragraph.
InsertDocProperty(CustomProperty, Formatting) | Insert a field of type document property, this field will display the custom property cp, at the end of this paragraph.

See Also

Paragraph Class
Paragraph Members


InsertDocProperty Method (CustomProperty)

[image]

A Sandcastle Documented Class Library
Paragraph..::.InsertDocProperty Method (CustomProperty)
Paragraph Class Example See Also Send Feedback
Insert a field of type document property, this field will display the custom property cp, at the end of this paragraph.

Namespace: Novacode
Assembly: DocX (in DocX.dll) Version: 1.0.0.7 (1.0.0.7)

Syntax

C#
public void InsertDocProperty(
    CustomProperty cp
)
Visual Basic (Declaration)
Public Sub InsertDocProperty ( _
    cp As CustomProperty _
)
Visual C++
public:
void InsertDocProperty(
    CustomProperty^ cp
)

Parameters

cp
Type: Novacode..::.CustomProperty
The custom property to display.

Examples

Create, add and display a custom property in a document.
CopyC#
// Load a document
using (DocX document = DocX.Create(@"Test.docx"))
{
    // Create a custom property.
    CustomProperty name = new CustomProperty("name", "Cathal Coffey");

    // Add this custom property to this document.
    document.AddCustomProperty(name);

    // Insert a new paragraph.
    Paragraph p = document.InsertParagraph("Author: ", false);

    // Insert a field of type document property to display the custom property name
    p.InsertDocProperty(name);

    // Save all changes made to this document.
    document.Save();
}// Release this document from memory.

See Also

Paragraph Class
InsertDocProperty Overload


InsertDocProperty Method (CustomProperty, Formatting)

[image]

A Sandcastle Documented Class Library
Paragraph..::.InsertDocProperty Method (CustomProperty, Formatting)
Paragraph Class Example See Also Send Feedback
Insert a field of type document property, this field will display the custom property cp, at the end of this paragraph.

Namespace: Novacode
Assembly: DocX (in DocX.dll) Version: 1.0.0.7 (1.0.0.7)

Syntax

C#
public void InsertDocProperty(
    CustomProperty cp,
    Formatting f
)
Visual Basic (Declaration)
Public Sub InsertDocProperty ( _
    cp As CustomProperty, _
    f As Formatting _
)
Visual C++
public:
void InsertDocProperty(
    CustomProperty^ cp,
    Formatting^ f
)

Parameters

cp
Type: Novacode..::.CustomProperty
The custom property to display.
f
Type: Novacode..::.Formatting
The formatting to use for this text.

Examples

Create, add and display a custom property in a document.
CopyC#
// Load a document
using (DocX document = DocX.Create(@"Test.docx"))
{
    // Create a custom property.
    CustomProperty name = new CustomProperty("name", "Cathal Coffey");

    // Add this custom property to this document.
    document.AddCustomProperty(name);

    // Create a text formatting.
    Formatting f = new Formatting();
    f.Bold = true;
    f.Size = 14;
    f.StrikeThrough = StrickThrough.strike;

    // Insert a new paragraph.
    Paragraph p = document.InsertParagraph("Author: ", false, f);

    // Insert a field of type document property to display the custom property name
    p.InsertDocProperty(name, f);

    // Save all changes made to this document.
    document.Save();
}// Release this document from memory.

See Also

Paragraph Class
InsertDocProperty Overload


InsertPageBreakAfterSelf Method

[image]

A Sandcastle Documented Class Library
Paragraph..::.InsertPageBreakAfterSelf Method
Paragraph Class Example See Also Send Feedback
Insert a page break after a Paragraph.

Namespace: Novacode
Assembly: DocX (in DocX.dll) Version: 1.0.0.7 (1.0.0.7)

Syntax

C#
public void InsertPageBreakAfterSelf()
Visual Basic (Declaration)
Public Sub InsertPageBreakAfterSelf
Visual C++
public:
void InsertPageBreakAfterSelf()

Examples

Insert 2 Paragraphs into a document with a page break between them.
CopyC#
using (DocX document = DocX.Create(@"Test.docx"))
{
   // Insert a new Paragraph.
   Paragraph p1 = document.InsertParagraph("Paragraph 1", false);

   // Insert a page break after this Paragraph.
   p1.InsertPageBreakAfterSelf();

   // Insert a new Paragraph.
   Paragraph p2 = document.InsertParagraph("Paragraph 2", false);

   // Save this document.
   document.Save();
}// Release this document from memory.

See Also

Paragraph Class


InsertPageBreakBeforeSelf Method

[image]

A Sandcastle Documented Class Library
Paragraph..::.InsertPageBreakBeforeSelf Method
Paragraph Class Example See Also Send Feedback
Insert a page break before a Paragraph.

Namespace: Novacode
Assembly: DocX (in DocX.dll) Version: 1.0.0.7 (1.0.0.7)

Syntax

C#
public void InsertPageBreakBeforeSelf()
Visual Basic (Declaration)
Public Sub InsertPageBreakBeforeSelf
Visual C++
public:
void InsertPageBreakBeforeSelf()

Examples

Insert 2 Paragraphs into a document with a page break between them.
CopyC#
using (DocX document = DocX.Create(@"Test.docx"))
{
   // Insert a new Paragraph.
   Paragraph p1 = document.InsertParagraph("Paragraph 1", false);

   // Insert a new Paragraph.
   Paragraph p2 = document.InsertParagraph("Paragraph 2", false);

   // Insert a page break before Paragraph two.
   p2.InsertPageBreakBeforeSelf();

   // Save this document.
   document.Save();
}// Release this document from memory.

See Also

Paragraph Class


InsertParagraphAfterSelf Method

[image] [image]

A Sandcastle Documented Class Library
Paragraph..::.InsertParagraphAfterSelf Method
Paragraph Class See Also Send Feedback

Overload List

Name | Description
InsertParagraphAfterSelf(Paragraph) | Insert a Paragraph after this Paragraph, this Paragraph may have come from the same or another document.
InsertParagraphAfterSelf(String) | Insert a new Paragraph after this Paragraph.
InsertParagraphAfterSelf(String, Boolean) | Insert a new Paragraph after this Paragraph.
InsertParagraphAfterSelf(String, Boolean, Formatting) | Insert a new Paragraph after this Paragraph.

See Also

Paragraph Class
Paragraph Members


InsertParagraphAfterSelf Method (Paragraph)

[image]

A Sandcastle Documented Class Library
Paragraph..::.InsertParagraphAfterSelf Method (Paragraph)
Paragraph Class Example See Also Send Feedback
Insert a Paragraph after this Paragraph, this Paragraph may have come from the same or another document.

Namespace: Novacode
Assembly: DocX (in DocX.dll) Version: 1.0.0.7 (1.0.0.7)

Syntax

C#
public Paragraph InsertParagraphAfterSelf(
    Paragraph p
)
Visual Basic (Declaration)
Public Function InsertParagraphAfterSelf ( _
    p As Paragraph _
) As Paragraph
Visual C++
public:
Paragraph^ InsertParagraphAfterSelf(
    Paragraph^ p
)

Parameters

p
Type: Novacode..::.Paragraph
The Paragraph to insert.

Return Value

The Paragraph now associated with this document.

Examples

Take a Paragraph from document a, and insert it into document b after this Paragraph.
CopyC#
// Place holder for a Paragraph.
Paragraph p;

// Load document a.
using (DocX documentA = DocX.Load(@"a.docx"))
{
    // Get the first paragraph from this document.
    p = documentA.Paragraphs[0];
}

// Load document b.
using (DocX documentB = DocX.Load(@"b.docx"))
{
    // Get the first Paragraph in document b.
    Paragraph p2 = documentB.Paragraphs[0];

    // Insert the Paragraph from document a after this Paragraph.
    Paragraph newParagraph = p2.InsertParagraphAfterSelf(p);

    // Save all changes made to document b.
    documentB.Save();
}// Release this document from memory.

See Also

Paragraph Class
InsertParagraphAfterSelf Overload


InsertParagraphAfterSelf Method (String)

[image]

A Sandcastle Documented Class Library
Paragraph..::.InsertParagraphAfterSelf Method (String)
Paragraph Class Example See Also Send Feedback
Insert a new Paragraph after this Paragraph.

Namespace: Novacode
Assembly: DocX (in DocX.dll) Version: 1.0.0.7 (1.0.0.7)

Syntax

C#
public Paragraph InsertParagraphAfterSelf(
    string text
)
Visual Basic (Declaration)
Public Function InsertParagraphAfterSelf ( _
    text As String _
) As Paragraph
Visual C++
public:
Paragraph^ InsertParagraphAfterSelf(
    String^ text
)

Parameters

text
Type: System..::.String
The initial text for this new Paragraph.

Return Value

A new Paragraph inserted after this Paragraph.

Examples

Insert a new paragraph after the first Paragraph in this document.
CopyC#
// Create a new document.
using (DocX document = DocX.Create(@"Test.docx"))
{
    // Insert a Paragraph into this document.
    Paragraph p = document.InsertParagraph("I am a Paragraph", false);

    p.InsertParagraphAfterSelf("I was inserted after the previous Paragraph.");

    // Save all changes made to this new document.
    document.Save();
   }// Release this new document form memory.

See Also

Paragraph Class
InsertParagraphAfterSelf Overload


InsertParagraphAfterSelf Method (String, Boolean)

[image]

A Sandcastle Documented Class Library
Paragraph..::.InsertParagraphAfterSelf Method (String, Boolean)
Paragraph Class Example See Also Send Feedback
Insert a new Paragraph after this Paragraph.

Namespace: Novacode
Assembly: DocX (in DocX.dll) Version: 1.0.0.7 (1.0.0.7)

Syntax

C#
public Paragraph InsertParagraphAfterSelf(
    string text,
    bool trackChanges
)
Visual Basic (Declaration)
Public Function InsertParagraphAfterSelf ( _
    text As String, _
    trackChanges As Boolean _
) As Paragraph
Visual C++
public:
Paragraph^ InsertParagraphAfterSelf(
    String^ text,
    bool trackChanges
)

Parameters

text
Type: System..::.String
The initial text for this new Paragraph.
trackChanges
Type: System..::.Boolean
Should this insertion be tracked as a change?

Return Value

A new Paragraph inserted after this Paragraph.

Examples

Insert a new paragraph after the first Paragraph in this document.
CopyC#
// Create a new document.
using (DocX document = DocX.Create(@"Test.docx"))
{
    // Insert a Paragraph into this document.
    Paragraph p = document.InsertParagraph("I am a Paragraph", false);

    p.InsertParagraphAfterSelf("I was inserted after the previous Paragraph.", false);

    // Save all changes made to this new document.
    document.Save();
   }// Release this new document form memory.

See Also

Paragraph Class
InsertParagraphAfterSelf Overload


InsertParagraphAfterSelf Method (String, Boolean, Formatting)

[image]

A Sandcastle Documented Class Library
Paragraph..::.InsertParagraphAfterSelf Method (String, Boolean, Formatting)
Paragraph Class Example See Also Send Feedback
Insert a new Paragraph after this Paragraph.

Namespace: Novacode
Assembly: DocX (in DocX.dll) Version: 1.0.0.7 (1.0.0.7)

Syntax

C#
public Paragraph InsertParagraphAfterSelf(
    string text,
    bool trackChanges,
    Formatting formatting
)
Visual Basic (Declaration)
Public Function InsertParagraphAfterSelf ( _
    text As String, _
    trackChanges As Boolean, _
    formatting As Formatting _
) As Paragraph
Visual C++
public:
Paragraph^ InsertParagraphAfterSelf(
    String^ text,
    bool trackChanges,
    Formatting^ formatting
)

Parameters

text
Type: System..::.String
The initial text for this new Paragraph.
trackChanges
Type: System..::.Boolean
Should this insertion be tracked as a change?
formatting
Type: Novacode..::.Formatting
The formatting to apply to this insertion.

Return Value

A new Paragraph inserted after this Paragraph.

Examples

Insert a new paragraph after the first Paragraph in this document.
CopyC#
// Create a new document.
using (DocX document = DocX.Create(@"Test.docx"))
{
    // Insert a Paragraph into this document.
    Paragraph p = document.InsertParagraph("I am a Paragraph", false);

    Formatting boldFormatting = new Formatting();
    boldFormatting.Bold = true;

    p.InsertParagraphAfterSelf("I was inserted after the previous Paragraph.", false, boldFormatting);

    // Save all changes made to this new document.
    document.Save();
   }// Release this new document form memory.

See Also

Paragraph Class
InsertParagraphAfterSelf Overload


InsertParagraphBeforeSelf Method

[image] [image]

A Sandcastle Documented Class Library
Paragraph..::.InsertParagraphBeforeSelf Method
Paragraph Class See Also Send Feedback

Overload List

Name | Description
InsertParagraphBeforeSelf(Paragraph) | Insert a Paragraph before this Paragraph, this Paragraph may have come from the same or another document.
InsertParagraphBeforeSelf(String) | Insert a new Paragraph before this Paragraph.
InsertParagraphBeforeSelf(String, Boolean) | Insert a new Paragraph before this Paragraph.
InsertParagraphBeforeSelf(String, Boolean, Formatting) | Insert a new Paragraph before this Paragraph.

See Also

Paragraph Class
Paragraph Members


InsertParagraphBeforeSelf Method (Paragraph)

[image]

A Sandcastle Documented Class Library
Paragraph..::.InsertParagraphBeforeSelf Method (Paragraph)
Paragraph Class Example See Also Send Feedback
Insert a Paragraph before this Paragraph, this Paragraph may have come from the same or another document.

Namespace: Novacode
Assembly: DocX (in DocX.dll) Version: 1.0.0.7 (1.0.0.7)

Syntax

C#
public Paragraph InsertParagraphBeforeSelf(
    Paragraph p
)
Visual Basic (Declaration)
Public Function InsertParagraphBeforeSelf ( _
    p As Paragraph _
) As Paragraph
Visual C++
public:
Paragraph^ InsertParagraphBeforeSelf(
    Paragraph^ p
)

Parameters

p
Type: Novacode..::.Paragraph
The Paragraph to insert.

Return Value

The Paragraph now associated with this document.

Examples

Take a Paragraph from document a, and insert it into document b before this Paragraph.
CopyC#
// Place holder for a Paragraph.
Paragraph p;

// Load document a.
using (DocX documentA = DocX.Load(@"a.docx"))
{
    // Get the first paragraph from this document.
    p = documentA.Paragraphs[0];
}

// Load document b.
using (DocX documentB = DocX.Load(@"b.docx"))
{
    // Get the first Paragraph in document b.
    Paragraph p2 = documentB.Paragraphs[0];

    // Insert the Paragraph from document a before this Paragraph.
    Paragraph newParagraph = p2.InsertParagraphBeforeSelf(p);

    // Save all changes made to document b.
    documentB.Save();
}// Release this document from memory.

See Also

Paragraph Class
InsertParagraphBeforeSelf Overload


InsertParagraphBeforeSelf Method (String)

[image]

A Sandcastle Documented Class Library
Paragraph..::.InsertParagraphBeforeSelf Method (String)
Paragraph Class Example See Also Send Feedback
Insert a new Paragraph before this Paragraph.

Namespace: Novacode
Assembly: DocX (in DocX.dll) Version: 1.0.0.7 (1.0.0.7)

Syntax

C#
public Paragraph InsertParagraphBeforeSelf(
    string text
)
Visual Basic (Declaration)
Public Function InsertParagraphBeforeSelf ( _
    text As String _
) As Paragraph
Visual C++
public:
Paragraph^ InsertParagraphBeforeSelf(
    String^ text
)

Parameters

text
Type: System..::.String
The initial text for this new Paragraph.

Return Value

A new Paragraph inserted before this Paragraph.

Examples

Insert a new paragraph before the first Paragraph in this document.
CopyC#
// Create a new document.
using (DocX document = DocX.Create(@"Test.docx"))
{
    // Insert a Paragraph into this document.
    Paragraph p = document.InsertParagraph("I am a Paragraph", false);

    p.InsertParagraphBeforeSelf("I was inserted before the next Paragraph.");

    // Save all changes made to this new document.
    document.Save();
   }// Release this new document form memory.

See Also

Paragraph Class
InsertParagraphBeforeSelf Overload


InsertParagraphBeforeSelf Method (String, Boolean)

[image]

A Sandcastle Documented Class Library
Paragraph..::.InsertParagraphBeforeSelf Method (String, Boolean)
Paragraph Class Example See Also Send Feedback
Insert a new Paragraph before this Paragraph.

Namespace: Novacode
Assembly: DocX (in DocX.dll) Version: 1.0.0.7 (1.0.0.7)

Syntax

C#
public Paragraph InsertParagraphBeforeSelf(
    string text,
    bool trackChanges
)
Visual Basic (Declaration)
Public Function InsertParagraphBeforeSelf ( _
    text As String, _
    trackChanges As Boolean _
) As Paragraph
Visual C++
public:
Paragraph^ InsertParagraphBeforeSelf(
    String^ text,
    bool trackChanges
)

Parameters

text
Type: System..::.String
The initial text for this new Paragraph.
trackChanges
Type: System..::.Boolean
Should this insertion be tracked as a change?

Return Value

A new Paragraph inserted before this Paragraph.

Examples

Insert a new paragraph before the first Paragraph in this document.
CopyC#
// Create a new document.
using (DocX document = DocX.Create(@"Test.docx"))
{
    // Insert a Paragraph into this document.
    Paragraph p = document.InsertParagraph("I am a Paragraph", false);

    p.InsertParagraphBeforeSelf("I was inserted before the next Paragraph.", false);

    // Save all changes made to this new document.
    document.Save();
   }// Release this new document form memory.

See Also

Paragraph Class
InsertParagraphBeforeSelf Overload


InsertParagraphBeforeSelf Method (String, Boolean, Formatting)

[image]

A Sandcastle Documented Class Library
Paragraph..::.InsertParagraphBeforeSelf Method (String, Boolean, Formatting)
Paragraph Class Example See Also Send Feedback
Insert a new Paragraph before this Paragraph.

Namespace: Novacode
Assembly: DocX (in DocX.dll) Version: 1.0.0.7 (1.0.0.7)

Syntax

C#
public Paragraph InsertParagraphBeforeSelf(
    string text,
    bool trackChanges,
    Formatting formatting
)
Visual Basic (Declaration)
Public Function InsertParagraphBeforeSelf ( _
    text As String, _
    trackChanges As Boolean, _
    formatting As Formatting _
) As Paragraph
Visual C++
public:
Paragraph^ InsertParagraphBeforeSelf(
    String^ text,
    bool trackChanges,
    Formatting^ formatting
)

Parameters

text
Type: System..::.String
The initial text for this new Paragraph.
trackChanges
Type: System..::.Boolean
Should this insertion be tracked as a change?
formatting
Type: Novacode..::.Formatting
The formatting to apply to this insertion.

Return Value

A new Paragraph inserted before this Paragraph.

Examples

Insert a new paragraph before the first Paragraph in this document.
CopyC#
// Create a new document.
using (DocX document = DocX.Create(@"Test.docx"))
{
    // Insert a Paragraph into this document.
    Paragraph p = document.InsertParagraph("I am a Paragraph", false);

    Formatting boldFormatting = new Formatting();
    boldFormatting.Bold = true;

    p.InsertParagraphBeforeSelf("I was inserted before the next Paragraph.", false, boldFormatting);

    // Save all changes made to this new document.
    document.Save();
   }// Release this new document form memory.

See Also

Paragraph Class
InsertParagraphBeforeSelf Overload


InsertPicture Method

[image] [image]

A Sandcastle Documented Class Library
Paragraph..::.InsertPicture Method
Paragraph Class See Also Send Feedback

Overload List

Name | Description
InsertPicture(String) |
InsertPicture(Int32, String) |
InsertPicture(String, String, String) | Insert a Picture at the end of this paragraph.
InsertPicture(Int32, String, String, String) | Insert a Picture into this Paragraph at a specified index.

See Also

Paragraph Class
Paragraph Members


InsertPicture Method (String)

[image]

A Sandcastle Documented Class Library
Paragraph..::.InsertPicture Method (String)
Paragraph Class See Also Send Feedback

[Missing <summary> documentation for "M:Novacode.Paragraph.InsertPicture(System.String)"]

Namespace: Novacode
Assembly: DocX (in DocX.dll) Version: 1.0.0.7 (1.0.0.7)

Syntax

C#
public Picture InsertPicture(
    string imageID
)
Visual Basic (Declaration)
Public Function InsertPicture ( _
    imageID As String _
) As Picture
Visual C++
public:
Picture^ InsertPicture(
    String^ imageID
)

Parameters

imageID
Type: System..::.String

[Missing <param name="imageID"/> documentation for "M:Novacode.Paragraph.InsertPicture(System.String)"]

Return Value

[Missing <returns> documentation for "M:Novacode.Paragraph.InsertPicture(System.String)"]

See Also

Paragraph Class
InsertPicture Overload


InsertPicture Method (Int32, String)

[image]

A Sandcastle Documented Class Library
Paragraph..::.InsertPicture Method (Int32, String)
Paragraph Class See Also Send Feedback

[Missing <summary> documentation for "M:Novacode.Paragraph.InsertPicture(System.Int32,System.String)"]

Namespace: Novacode
Assembly: DocX (in DocX.dll) Version: 1.0.0.7 (1.0.0.7)

Syntax

C#
public Picture InsertPicture(
    int index,
    string imageID
)
Visual Basic (Declaration)
Public Function InsertPicture ( _
    index As Integer, _
    imageID As String _
) As Picture
Visual C++
public:
Picture^ InsertPicture(
    int index,
    String^ imageID
)

Parameters

index
Type: System..::.Int32

[Missing <param name="index"/> documentation for "M:Novacode.Paragraph.InsertPicture(System.Int32,System.String)"]

imageID
Type: System..::.String

[Missing <param name="imageID"/> documentation for "M:Novacode.Paragraph.InsertPicture(System.Int32,System.String)"]

Return Value

[Missing <returns> documentation for "M:Novacode.Paragraph.InsertPicture(System.Int32,System.String)"]

See Also

Paragraph Class
InsertPicture Overload


InsertPicture Method (String, String, String)

[image]

A Sandcastle Documented Class Library
Paragraph..::.InsertPicture Method (String, String, String)
Paragraph Class Example See Also Send Feedback
Insert a Picture at the end of this paragraph.

Namespace: Novacode
Assembly: DocX (in DocX.dll) Version: 1.0.0.7 (1.0.0.7)

Syntax

C#
public Picture InsertPicture(
    string imageID,
    string name,
    string description
)
Visual Basic (Declaration)
Public Function InsertPicture ( _
    imageID As String, _
    name As String, _
    description As String _
) As Picture
Visual C++
public:
Picture^ InsertPicture(
    String^ imageID,
    String^ name,
    String^ description
)

Parameters

imageID
Type: System..::.String
The unique id that identifies the Image this Picture represents.
name
Type: System..::.String
The name of this image.
description
Type: System..::.String
A string to describe this Picture.

Return Value

A Picture.

Examples

CopyC#
// Create a document using a relative filename.
using (DocX document = DocX.Create(@"Test.docx"))
{
    // Add a new Paragraph to this document.
    Paragraph p = document.InsertParagraph("Here is Picture 1", false);

    // Add an Image to this document.
    Novacode.Image img = document.AddImage(@"Image.jpg");

    // Insert pic at the end of Paragraph p.
    Picture pic = p.InsertPicture(img.Id, "Photo 31415", "A pie I baked.");

    // Rotate the Picture clockwise by 30 degrees.
    pic.Rotation = 30;

    // Resize the Picture.
    pic.Width = 400;
    pic.Height = 300;

    // Set the shape of this Picture to be a cube.
    pic.SetPictureShape(BasicShapes.cube);

    // Flip the Picture Horizontally.
    pic.FlipHorizontal = true;

    // Save all changes made to this document.
    document.Save();
}// Release this document from memory.

See Also

Paragraph Class
InsertPicture Overload


InsertPicture Method (Int32, String, String, String)

[image]

A Sandcastle Documented Class Library
Paragraph..::.InsertPicture Method (Int32, String, String, String)
Paragraph Class Example See Also Send Feedback
Insert a Picture into this Paragraph at a specified index.

Namespace: Novacode
Assembly: DocX (in DocX.dll) Version: 1.0.0.7 (1.0.0.7)

Syntax

C#
public Picture InsertPicture(
    int index,
    string imageID,
    string name,
    string description
)
Visual Basic (Declaration)
Public Function InsertPicture ( _
    index As Integer, _
    imageID As String, _
    name As String, _
    description As String _
) As Picture
Visual C++
public:
Picture^ InsertPicture(
    int index,
    String^ imageID,
    String^ name,
    String^ description
)

Parameters

index
Type: System..::.Int32
The index to insert this Picture at.
imageID
Type: System..::.String
The unique id that identifies the Image this Picture represents.
name
Type: System..::.String
The name of this image.
description
Type: System..::.String
A string to describe this Picture.

Return Value

A Picture.

Examples

CopyC#
// Create a document using a relative filename.
using (DocX document = DocX.Create(@"Test.docx"))
{
    // Add a new Paragraph to this document.
    Paragraph p = document.InsertParagraph("Here is Picture 1", false);

    // Add an Image to this document.
    Novacode.Image img = document.AddImage(@"Image.jpg");

    // Insert pic at the start of Paragraph p.
    Picture pic = p.InsertPicture(0, img.Id, "Photo 31415", "A pie I baked.");

    // Rotate the Picture clockwise by 30 degrees.
    pic.Rotation = 30;

    // Resize the Picture.
    pic.Width = 400;
    pic.Height = 300;

    // Set the shape of this Picture to be a cube.
    pic.SetPictureShape(BasicShapes.cube);

    // Flip the Picture Horizontally.
    pic.FlipHorizontal = true;

    // Save all changes made to this document.
    document.Save();
}// Release this document from memory.

See Also

Paragraph Class
InsertPicture Overload


InsertTableAfterSelf Method

[image] [image]

A Sandcastle Documented Class Library
Paragraph..::.InsertTableAfterSelf Method
Paragraph Class See Also Send Feedback

Overload List

Name | Description
InsertTableAfterSelf(Table) | Insert a new Table after this Paragraph.
InsertTableAfterSelf(Int32, Int32) | Insert a new Table into this document after this Paragraph.

See Also

Paragraph Class
Paragraph Members


InsertTableAfterSelf Method (Table)

[image]

A Sandcastle Documented Class Library
Paragraph..::.InsertTableAfterSelf Method (Table)
Paragraph Class Example See Also Send Feedback
Insert a new Table after this Paragraph.

Namespace: Novacode
Assembly: DocX (in DocX.dll) Version: 1.0.0.7 (1.0.0.7)

Syntax

C#
public Table InsertTableAfterSelf(
    Table t
)
Visual Basic (Declaration)
Public Function InsertTableAfterSelf ( _
    t As Table _
) As Table
Visual C++
public:
Table^ InsertTableAfterSelf(
    Table^ t
)

Parameters

t
Type: Novacode..::.Table
The Table t to be inserted.

Return Value

A new Table inserted after this Paragraph.

Examples

Insert a new Table after this Paragraph.
CopyC#
// Place holder for a Table.
Table t;

// Load document a.
using (DocX documentA = DocX.Load(@"a.docx"))
{
    // Get the first Table from this document.
    t = documentA.Tables[0];
}

// Load document b.
using (DocX documentB = DocX.Load(@"b.docx"))
{
    // Get the first Paragraph in document b.
    Paragraph p2 = documentB.Paragraphs[0];

    // Insert the Table from document a after this Paragraph.
    Table newTable = p2.InsertTableAfterSelf(t);

    // Save all changes made to document b.
    documentB.Save();
}// Release this document from memory.

See Also

Paragraph Class
InsertTableAfterSelf Overload


InsertTableAfterSelf Method (Int32, Int32)

[image]

A Sandcastle Documented Class Library
Paragraph..::.InsertTableAfterSelf Method (Int32, Int32)
Paragraph Class Example See Also Send Feedback
Insert a new Table into this document after this Paragraph.

Namespace: Novacode
Assembly: DocX (in DocX.dll) Version: 1.0.0.7 (1.0.0.7)

Syntax

C#
public Table InsertTableAfterSelf(
    int rowCount,
    int coloumnCount
)
Visual Basic (Declaration)
Public Function InsertTableAfterSelf ( _
    rowCount As Integer, _
    coloumnCount As Integer _
) As Table
Visual C++
public:
Table^ InsertTableAfterSelf(
    int rowCount,
    int coloumnCount
)

Parameters

rowCount
Type: System..::.Int32
The number of rows this Table should have.
coloumnCount
Type: System..::.Int32
The number of coloumns this Table should have.

Return Value

A new Table inserted after this Paragraph.

Examples

CopyC#
// Create a new document.
using (DocX document = DocX.Create(@"Test.docx"))
{
    //Insert a Paragraph into this document.
    Paragraph p = document.InsertParagraph("Hello World", false);

    // Insert a new Table after this Paragraph.
    Table newTable = p.InsertTableAfterSelf(2, 2);
    newTable.Design = TableDesign.LightShadingAccent2;
    newTable.Alignment = Alignment.center;

    // Save all changes made to this document.
    document.Save();
}// Release this document from memory.

See Also

Paragraph Class
InsertTableAfterSelf Overload


InsertTableBeforeSelf Method

[image] [image]

A Sandcastle Documented Class Library
Paragraph..::.InsertTableBeforeSelf Method
Paragraph Class See Also Send Feedback

Overload List

Name | Description
InsertTableBeforeSelf(Table) | Insert a new Table before this Paragraph, this Table can be from this document or another document.
InsertTableBeforeSelf(Int32, Int32) | Insert a new Table into this document before this Paragraph.

See Also

Paragraph Class
Paragraph Members


InsertTableBeforeSelf Method (Table)

[image]

A Sandcastle Documented Class Library
Paragraph..::.InsertTableBeforeSelf Method (Table)
Paragraph Class Example See Also Send Feedback
Insert a new Table before this Paragraph, this Table can be from this document or another document.

Namespace: Novacode
Assembly: DocX (in DocX.dll) Version: 1.0.0.7 (1.0.0.7)

Syntax

C#
public Table InsertTableBeforeSelf(
    Table t
)
Visual Basic (Declaration)
Public Function InsertTableBeforeSelf ( _
    t As Table _
) As Table
Visual C++
public:
Table^ InsertTableBeforeSelf(
    Table^ t
)

Parameters

t
Type: Novacode..::.Table
The Table t to be inserted.

Return Value

A new Table inserted before this Paragraph.

Examples

Insert a new Table before this Paragraph.
CopyC#
// Place holder for a Table.
Table t;

// Load document a.
using (DocX documentA = DocX.Load(@"a.docx"))
{
    // Get the first Table from this document.
    t = documentA.Tables[0];
}

// Load document b.
using (DocX documentB = DocX.Load(@"b.docx"))
{
    // Get the first Paragraph in document b.
    Paragraph p2 = documentB.Paragraphs[0];

    // Insert the Table from document a before this Paragraph.
    Table newTable = p2.InsertTableBeforeSelf(t);

    // Save all changes made to document b.
    documentB.Save();
}// Release this document from memory.

See Also

Paragraph Class
InsertTableBeforeSelf Overload


InsertTableBeforeSelf Method (Int32, Int32)

[image]

A Sandcastle Documented Class Library
Paragraph..::.InsertTableBeforeSelf Method (Int32, Int32)
Paragraph Class Example See Also Send Feedback
Insert a new Table into this document before this Paragraph.

Namespace: Novacode
Assembly: DocX (in DocX.dll) Version: 1.0.0.7 (1.0.0.7)

Syntax

C#
public Table InsertTableBeforeSelf(
    int rowCount,
    int coloumnCount
)
Visual Basic (Declaration)
Public Function InsertTableBeforeSelf ( _
    rowCount As Integer, _
    coloumnCount As Integer _
) As Table
Visual C++
public:
Table^ InsertTableBeforeSelf(
    int rowCount,
    int coloumnCount
)

Parameters

rowCount
Type: System..::.Int32
The number of rows this Table should have.
coloumnCount
Type: System..::.Int32
The number of coloumns this Table should have.

Return Value

A new Table inserted before this Paragraph.

Examples

CopyC#
// Create a new document.
using (DocX document = DocX.Create(@"Test.docx"))
{
    //Insert a Paragraph into this document.
    Paragraph p = document.InsertParagraph("Hello World", false);

    // Insert a new Table before this Paragraph.
    Table newTable = p.InsertTableBeforeSelf(2, 2);
    newTable.Design = TableDesign.LightShadingAccent2;
    newTable.Alignment = Alignment.center;

    // Save all changes made to this document.
    document.Save();
}// Release this document from memory.

See Also

Paragraph Class
InsertTableBeforeSelf Overload


InsertText Method

[image] [image]

A Sandcastle Documented Class Library
Paragraph..::.InsertText Method
Paragraph Class See Also Send Feedback

Overload List

Name | Description
InsertText(String, Boolean) | Inserts a specified instance of System.String into a Novacode.DocX.Paragraph at a specified index position.
InsertText(Int32, String, Boolean) | Inserts a specified instance of System.String into a Novacode.DocX.Paragraph at a specified index position.
InsertText(String, Boolean, Formatting) | Inserts a specified instance of System.String into a Novacode.DocX.Paragraph at a specified index position.
InsertText(Int32, String, Boolean, Formatting) | Inserts a specified instance of System.String into a Novacode.DocX.Paragraph at a specified index position.

See Also

Paragraph Class
Paragraph Members


InsertText Method (String, Boolean)

[image]

A Sandcastle Documented Class Library
Paragraph..::.InsertText Method (String, Boolean)
Paragraph Class Example See Also Send Feedback
Inserts a specified instance of System.String into a Novacode.DocX.Paragraph at a specified index position.

Namespace: Novacode
Assembly: DocX (in DocX.dll) Version: 1.0.0.7 (1.0.0.7)

Syntax

C#
public void InsertText(
    string value,
    bool trackChanges
)
Visual Basic (Declaration)
Public Sub InsertText ( _
    value As String, _
    trackChanges As Boolean _
)
Visual C++
public:
void InsertText(
    String^ value,
    bool trackChanges
)

Parameters

value
Type: System..::.String
The System.String to insert.
trackChanges
Type: System..::.Boolean
Flag this insert as a change.

Examples

CopyC#
// Create a document using a relative filename.
using (DocX document = DocX.Load(@"C:\Example\Test.docx"))
{
    // Iterate through the Paragraphs in this document.
    foreach (Paragraph p in document.Paragraphs)
    {
        // Insert the string "End: " at the end of every Paragraph and flag it as a change.
        p.InsertText("End: ", true);
    }

    // Save all changes made to this document.
    document.Save();
}// Release this document from memory.

Examples

Inserting tabs using the \t switch.
CopyC#
// Create a document using a relative filename.
using (DocX document = DocX.Load(@"C:\Example\Test.docx"))
{
    // Iterate through the paragraphs in this document.
    foreach (Paragraph p in document.Paragraphs)
    {
        // Insert the string "\tEnd" at the end of every paragraph and flag it as a change.
        p.InsertText("\tEnd", true);
    }

    // Save all changes made to this document.
    document.Save();
}// Release this document from memory.

See Also

Paragraph Class
InsertText Overload
Novacode Namespace
Paragraph..::.RemoveText(Int32, Boolean)
Paragraph..::.RemoveText(Int32, Int32, Boolean)
Paragraph..::.ReplaceText(String, String, Boolean)
Paragraph..::.ReplaceText(String, String, Boolean, RegexOptions)


InsertText Method (Int32, String, Boolean)

[image]

A Sandcastle Documented Class Library
Paragraph..::.InsertText Method (Int32, String, Boolean)
Paragraph Class Example See Also Send Feedback
Inserts a specified instance of System.String into a Novacode.DocX.Paragraph at a specified index position.

Namespace: Novacode
Assembly: DocX (in DocX.dll) Version: 1.0.0.7 (1.0.0.7)

Syntax

C#
public void InsertText(
    int index,
    string value,
    bool trackChanges
)
Visual Basic (Declaration)
Public Sub InsertText ( _
    index As Integer, _
    value As String, _
    trackChanges As Boolean _
)
Visual C++
public:
void InsertText(
    int index,
    String^ value,
    bool trackChanges
)

Parameters

index
Type: System..::.Int32
The index position of the insertion.
value
Type: System..::.String
The System.String to insert.
trackChanges
Type: System..::.Boolean
Flag this insert as a change.

Examples

CopyC#
// Create a document using a relative filename.
using (DocX document = DocX.Load(@"C:\Example\Test.docx"))
{
    // Iterate through the Paragraphs in this document.
    foreach (Paragraph p in document.Paragraphs)
    {
        // Insert the string "Start: " at the begining of every Paragraph and flag it as a change.
        p.InsertText(0, "Start: ", true);
    }

    // Save all changes made to this document.
    document.Save();
}// Release this document from memory.

Examples

Inserting tabs using the \t switch.
CopyC#
// Create a document using a relative filename.
using (DocX document = DocX.Load(@"C:\Example\Test.docx"))
{
    // Iterate through the paragraphs in this document.
    foreach (Paragraph p in document.Paragraphs)
    {
        // Insert the string "\tStart:\t" at the begining of every paragraph and flag it as a change.
        p.InsertText(0, "\tStart:\t", true);
    }

    // Save all changes made to this document.
    document.Save();
}// Release this document from memory.

See Also

Paragraph Class
InsertText Overload
Novacode Namespace
Paragraph..::.RemoveText(Int32, Boolean)
Paragraph..::.RemoveText(Int32, Int32, Boolean)
Paragraph..::.ReplaceText(String, String, Boolean)
Paragraph..::.ReplaceText(String, String, Boolean, RegexOptions)


InsertText Method (String, Boolean, Formatting)

[image]

A Sandcastle Documented Class Library
Paragraph..::.InsertText Method (String, Boolean, Formatting)
Paragraph Class Example See Also Send Feedback
Inserts a specified instance of System.String into a Novacode.DocX.Paragraph at a specified index position.

Namespace: Novacode
Assembly: DocX (in DocX.dll) Version: 1.0.0.7 (1.0.0.7)

Syntax

C#
public void InsertText(
    string value,
    bool trackChanges,
    Formatting formatting
)
Visual Basic (Declaration)
Public Sub InsertText ( _
    value As String, _
    trackChanges As Boolean, _
    formatting As Formatting _
)
Visual C++
public:
void InsertText(
    String^ value,
    bool trackChanges,
    Formatting^ formatting
)

Parameters

value
Type: System..::.String
The System.String to insert.
trackChanges
Type: System..::.Boolean
Flag this insert as a change.
formatting
Type: Novacode..::.Formatting
The text formatting.

Examples

CopyC#
// Create a document using a relative filename.
using (DocX document = DocX.Load(@"C:\Example\Test.docx"))
{
    // Create a text formatting.
    Formatting f = new Formatting();
    f.FontColor = Color.Red;
    f.Size = 30;

    // Iterate through the Paragraphs in this document.
    foreach (Paragraph p in document.Paragraphs)
    {
        // Insert the string "Start: " at the begining of every Paragraph and flag it as a change.
        p.InsertText("Start: ", true, f);
    }

    // Save all changes made to this document.
    document.Save();
}// Release this document from memory.

Examples

Inserting tabs using the \t switch.
CopyC#
// Create a document using a relative filename.
using (DocX document = DocX.Load(@"C:\Example\Test.docx"))
{
     // Create a text formatting.
     Formatting f = new Formatting();
     f.FontColor = Color.Red;
     f.Size = 30;

     // Iterate through the paragraphs in this document.
     foreach (Paragraph p in document.Paragraphs)
     {
         // Insert the string "\tEnd" at the end of every paragraph and flag it as a change.
         p.InsertText("\tEnd", true, f);
     }

    // Save all changes made to this document.
    document.Save();
}// Release this document from memory.

See Also

Paragraph Class
InsertText Overload
Novacode Namespace
Paragraph..::.RemoveText(Int32, Boolean)
Paragraph..::.RemoveText(Int32, Int32, Boolean)
Paragraph..::.ReplaceText(String, String, Boolean)
Paragraph..::.ReplaceText(String, String, Boolean, RegexOptions)


InsertText Method (Int32, String, Boolean, Formatting)

[image]

A Sandcastle Documented Class Library
Paragraph..::.InsertText Method (Int32, String, Boolean, Formatting)
Paragraph Class Example See Also Send Feedback
Inserts a specified instance of System.String into a Novacode.DocX.Paragraph at a specified index position.

Namespace: Novacode
Assembly: DocX (in DocX.dll) Version: 1.0.0.7 (1.0.0.7)

Syntax

C#
public void InsertText(
    int index,
    string value,
    bool trackChanges,
    Formatting formatting
)
Visual Basic (Declaration)
Public Sub InsertText ( _
    index As Integer, _
    value As String, _
    trackChanges As Boolean, _
    formatting As Formatting _
)
Visual C++
public:
void InsertText(
    int index,
    String^ value,
    bool trackChanges,
    Formatting^ formatting
)

Parameters

index
Type: System..::.Int32
The index position of the insertion.
value
Type: System..::.String
The System.String to insert.
trackChanges
Type: System..::.Boolean
Flag this insert as a change.
formatting
Type: Novacode..::.Formatting
The text formatting.

Examples

CopyC#
// Create a document using a relative filename.
using (DocX document = DocX.Load(@"C:\Example\Test.docx"))
{
    // Create a text formatting.
    Formatting f = new Formatting();
    f.FontColor = Color.Red;
    f.Size = 30;

    // Iterate through the Paragraphs in this document.
    foreach (Paragraph p in document.Paragraphs)
    {
        // Insert the string "Start: " at the begining of every Paragraph and flag it as a change.
        p.InsertText(0, "Start: ", true, f);
    }

    // Save all changes made to this document.
    document.Save();
}// Release this document from memory.

Examples

Inserting tabs using the \t switch.
CopyC#
// Create a document using a relative filename.
using (DocX document = DocX.Load(@"C:\Example\Test.docx"))
{
    // Create a text formatting.
    Formatting f = new Formatting();
    f.FontColor = Color.Red;
    f.Size = 30;

    // Iterate through the paragraphs in this document.
    foreach (Paragraph p in document.Paragraphs)
    {
        // Insert the string "\tStart:\t" at the begining of every paragraph and flag it as a change.
        p.InsertText(0, "\tStart:\t", true, f);
    }

    // Save all changes made to this document.
    document.Save();
}// Release this document from memory.

See Also

Paragraph Class
InsertText Overload
Novacode Namespace
Paragraph..::.RemoveText(Int32, Boolean)
Paragraph..::.RemoveText(Int32, Int32, Boolean)
Paragraph..::.ReplaceText(String, String, Boolean)
Paragraph..::.ReplaceText(String, String, Boolean, RegexOptions)


Italic Method

[image]

A Sandcastle Documented Class Library
Paragraph..::.Italic Method
Paragraph Class Example See Also Send Feedback
For use with Append() and AppendLine()

Namespace: Novacode
Assembly: DocX (in DocX.dll) Version: 1.0.0.7 (1.0.0.7)

Syntax

C#
public Paragraph Italic()
Visual Basic (Declaration)
Public Function Italic As Paragraph
Visual C++
public:
Paragraph^ Italic()

Return Value

This Paragraph with the last appended text italic.

Examples

Append text to this Paragraph and then make it italic.
CopyC#
// Create a document.
using (DocX document = DocX.Create(@"Test.docx"))
{
    // Insert a new Paragraph.
    Paragraph p = document.InsertParagraph();

    p.Append("I am ")
    .Append("Italic").Italic()
    .Append(" I am not");

    // Save this document.
    document.Save();
}// Release this document from memory.

See Also

Paragraph Class


Kerning Method

[image]

A Sandcastle Documented Class Library
Paragraph..::.Kerning Method
Paragraph Class See Also Send Feedback

[Missing <summary> documentation for "M:Novacode.Paragraph.Kerning(System.Int32)"]

Namespace: Novacode
Assembly: DocX (in DocX.dll) Version: 1.0.0.7 (1.0.0.7)

Syntax

C#
public Paragraph Kerning(
    int kerning
)
Visual Basic (Declaration)
Public Function Kerning ( _
    kerning As Integer _
) As Paragraph
Visual C++
public:
Paragraph^ Kerning(
    int kerning
)

Parameters

kerning
Type: System..::.Int32

[Missing <param name="kerning"/> documentation for "M:Novacode.Paragraph.Kerning(System.Int32)"]

Return Value

[Missing <returns> documentation for "M:Novacode.Paragraph.Kerning(System.Int32)"]

See Also

Paragraph Class


Misc Method

[image]

A Sandcastle Documented Class Library
Paragraph..::.Misc Method
Paragraph Class Example See Also Send Feedback
For use with Append() and AppendLine()

Namespace: Novacode
Assembly: DocX (in DocX.dll) Version: 1.0.0.7 (1.0.0.7)

Syntax

C#
public Paragraph Misc(
    Misc misc
)
Visual Basic (Declaration)
Public Function Misc ( _
    misc As Misc _
) As Paragraph
Visual C++
public:
Paragraph^ Misc(
    Misc misc
)

Parameters

misc
Type: Novacode..::.Misc
The miscellaneous property to set.

Return Value

This Paragraph with the last appended text changed by a miscellaneous property.

Examples

Append text to this Paragraph and then apply a miscellaneous property.
CopyC#
// Create a document.
using (DocX document = DocX.Create(@"Test.docx"))
{
    // Insert a new Paragraph.
    Paragraph p = document.InsertParagraph();

    p.Append("I am ")
    .Append("outlined").Misc(Misc.outline)
    .Append(" I am not");

    // Save this document.
    document.Save();
}// Release this document from memory.

See Also

Paragraph Class


PercentageScale Method

[image]

A Sandcastle Documented Class Library
Paragraph..::.PercentageScale Method
Paragraph Class See Also Send Feedback

[Missing <summary> documentation for "M:Novacode.Paragraph.PercentageScale(System.Int32)"]

Namespace: Novacode
Assembly: DocX (in DocX.dll) Version: 1.0.0.7 (1.0.0.7)

Syntax

C#
public Paragraph PercentageScale(
    int percentageScale
)
Visual Basic (Declaration)
Public Function PercentageScale ( _
    percentageScale As Integer _
) As Paragraph
Visual C++
public:
Paragraph^ PercentageScale(
    int percentageScale
)

Parameters

percentageScale
Type: System..::.Int32

[Missing <param name="percentageScale"/> documentation for "M:Novacode.Paragraph.PercentageScale(System.Int32)"]

Return Value

[Missing <returns> documentation for "M:Novacode.Paragraph.PercentageScale(System.Int32)"]

See Also

Paragraph Class


Position Method

[image]

A Sandcastle Documented Class Library
Paragraph..::.Position Method
Paragraph Class See Also Send Feedback

[Missing <summary> documentation for "M:Novacode.Paragraph.Position(System.Double)"]

Namespace: Novacode
Assembly: DocX (in DocX.dll) Version: 1.0.0.7 (1.0.0.7)

Syntax

C#
public Paragraph Position(
    double position
)
Visual Basic (Declaration)
Public Function Position ( _
    position As Double _
) As Paragraph
Visual C++
public:
Paragraph^ Position(
    double position
)

Parameters

position
Type: System..::.Double

[Missing <param name="position"/> documentation for "M:Novacode.Paragraph.Position(System.Double)"]

Return Value

[Missing <returns> documentation for "M:Novacode.Paragraph.Position(System.Double)"]

See Also

Paragraph Class


Remove Method

[image]

A Sandcastle Documented Class Library
Paragraph..::.Remove Method
Paragraph Class Example See Also Send Feedback
Remove this Paragraph from the document.

Namespace: Novacode
Assembly: DocX (in DocX.dll) Version: 1.0.0.7 (1.0.0.7)

Syntax

C#
public void Remove(
    bool trackChanges
)
Visual Basic (Declaration)
Public Sub Remove ( _
    trackChanges As Boolean _
)
Visual C++
public:
void Remove(
    bool trackChanges
)

Parameters

trackChanges
Type: System..::.Boolean
Should this remove be tracked as a change?

Examples

Remove a Paragraph from a document and track it as a change.
CopyC#
// Create a document using a relative filename.
using (DocX document = DocX.Load(@"C:\Example\Test.docx"))
{
    // Create and Insert a new Paragraph into this document.
    Paragraph p = document.InsertParagraph("Hello", false);

    // Remove the Paragraph and track this as a change.
    p.Remove(true);

    // Save all changes made to this document.
    document.Save();
}// Release this document from memory.

See Also

Paragraph Class


RemoveText Method

[image] [image]

A Sandcastle Documented Class Library
Paragraph..::.RemoveText Method
Paragraph Class See Also Send Feedback

Overload List

Name | Description
RemoveText(Int32, Boolean) | Removes characters from a Novacode.DocX.Paragraph.
RemoveText(Int32, Int32, Boolean) | Removes characters from a Novacode.DocX.Paragraph.

See Also

Paragraph Class
Paragraph Members


RemoveText Method (Int32, Boolean)

[image]

A Sandcastle Documented Class Library
Paragraph..::.RemoveText Method (Int32, Boolean)
Paragraph Class Example See Also Send Feedback
Removes characters from a Novacode.DocX.Paragraph.

Namespace: Novacode
Assembly: DocX (in DocX.dll) Version: 1.0.0.7 (1.0.0.7)

Syntax

C#
public void RemoveText(
    int index,
    bool trackChanges
)
Visual Basic (Declaration)
Public Sub RemoveText ( _
    index As Integer, _
    trackChanges As Boolean _
)
Visual C++
public:
void RemoveText(
    int index,
    bool trackChanges
)

Parameters

index
Type: System..::.Int32
The position to begin deleting characters.
trackChanges
Type: System..::.Boolean
Track changes

Examples

CopyC#
// Create a document using a relative filename.
using (DocX document = DocX.Load(@"C:\Example\Test.docx"))
{
    // Iterate through the paragraphs
    foreach (Paragraph p in document.Paragraphs)
    {
        // Remove all but the first 2 characters from this Paragraph.
        p.RemoveText(2, false);
    }

    // Save all changes made to this document.
    document.Save();
}// Release this document from memory.

See Also

Paragraph Class
RemoveText Overload
Novacode Namespace
Paragraph..::.ReplaceText(String, String, Boolean)
Paragraph..::.ReplaceText(String, String, Boolean, RegexOptions)
Paragraph..::.InsertText(String, Boolean)
Paragraph..::.InsertText(Int32, String, Boolean)
Paragraph..::.InsertText(Int32, String, Boolean, Formatting)
Paragraph..::.InsertText(String, Boolean, Formatting)


RemoveText Method (Int32, Int32, Boolean)

[image]

A Sandcastle Documented Class Library
Paragraph..::.RemoveText Method (Int32, Int32, Boolean)
Paragraph Class Example See Also Send Feedback
Removes characters from a Novacode.DocX.Paragraph.

Namespace: Novacode
Assembly: DocX (in DocX.dll) Version: 1.0.0.7 (1.0.0.7)

Syntax

C#
public void RemoveText(
    int index,
    int count,
    bool trackChanges
)
Visual Basic (Declaration)
Public Sub RemoveText ( _
    index As Integer, _
    count As Integer, _
    trackChanges As Boolean _
)
Visual C++
public:
void RemoveText(
    int index,
    int count,
    bool trackChanges
)

Parameters

index
Type: System..::.Int32
The position to begin deleting characters.
count
Type: System..::.Int32
The number of characters to delete
trackChanges
Type: System..::.Boolean
Track changes

Examples

CopyC#
// Create a document using a relative filename.
using (DocX document = DocX.Load(@"C:\Example\Test.docx"))
{
    // Iterate through the paragraphs
    foreach (Paragraph p in document.Paragraphs)
    {
        // Remove the first two characters from every paragraph
        p.RemoveText(0, 2, false);
    }

    // Save all changes made to this document.
    document.Save();
}// Release this document from memory.

See Also

Paragraph Class
RemoveText Overload
Novacode Namespace
Paragraph..::.ReplaceText(String, String, Boolean)
Paragraph..::.ReplaceText(String, String, Boolean, RegexOptions)
Paragraph..::.InsertText(String, Boolean)
Paragraph..::.InsertText(Int32, String, Boolean)
Paragraph..::.InsertText(Int32, String, Boolean, Formatting)
Paragraph..::.InsertText(String, Boolean, Formatting)


ReplaceText Method

[image] [image]

A Sandcastle Documented Class Library
Paragraph..::.ReplaceText Method
Paragraph Class See Also Send Feedback

Overload List

Name | Description
ReplaceText(String, String, Boolean) | Replaces all occurrences of a specified System.String in this instance, with another specified System.String.
ReplaceText(String, String, Boolean, RegexOptions) | Replaces all occurrences of a specified System.String in this instance, with another specified System.String.
ReplaceText(String, String, Boolean, RegexOptions, Formatting) | Replaces all occurrences of a specified System.String in this instance, with another specified System.String.
ReplaceText(String, String, Boolean, RegexOptions, Formatting, Formatting, MatchFormattingOptions) | Replaces all occurrences of a specified System.String in this instance, with another specified System.String.

See Also

Paragraph Class
Paragraph Members


ReplaceText Method (String, String, Boolean)

[image]

A Sandcastle Documented Class Library
Paragraph..::.ReplaceText Method (String, String, Boolean)
Paragraph Class Example See Also Send Feedback
Replaces all occurrences of a specified System.String in this instance, with another specified System.String.

Namespace: Novacode
Assembly: DocX (in DocX.dll) Version: 1.0.0.7 (1.0.0.7)

Syntax

C#
public void ReplaceText(
    string oldValue,
    string newValue,
    bool trackChanges
)
Visual Basic (Declaration)
Public Sub ReplaceText ( _
    oldValue As String, _
    newValue As String, _
    trackChanges As Boolean _
)
Visual C++
public:
void ReplaceText(
    String^ oldValue,
    String^ newValue,
    bool trackChanges
)

Parameters

oldValue
Type: System..::.String
A System.String to be replaced.
newValue
Type: System..::.String
A System.String to replace all occurances of oldValue.
trackChanges
Type: System..::.Boolean
Track changes

Examples

CopyC#
// Create a document using a relative filename.
using (DocX document = DocX.Load(@"C:\Example\Test.docx"))
{
    // Iterate through the paragraphs in this document.
    foreach (Paragraph p in document.Paragraphs)
    {
        // Replace all instances of the string "wrong" with the string "right".
        p.ReplaceText("wrong", "right", false);
    }

    // Save all changes made to this document.
    document.Save();
}// Release this document from memory.

See Also

Paragraph Class
ReplaceText Overload
Novacode Namespace
Paragraph..::.RemoveText(Int32, Int32, Boolean)
Paragraph..::.RemoveText(Int32, Boolean)
Paragraph..::.InsertText(String, Boolean)
Paragraph..::.InsertText(Int32, String, Boolean)
Paragraph..::.InsertText(Int32, String, Boolean, Formatting)
Paragraph..::.InsertText(String, Boolean, Formatting)


ReplaceText Method (String, String, Boolean, RegexOptions)

[image]

A Sandcastle Documented Class Library
Paragraph..::.ReplaceText Method (String, String, Boolean, RegexOptions)
Paragraph Class Example See Also Send Feedback
Replaces all occurrences of a specified System.String in this instance, with another specified System.String.

Namespace: Novacode
Assembly: DocX (in DocX.dll) Version: 1.0.0.7 (1.0.0.7)

Syntax

C#
public void ReplaceText(
    string oldValue,
    string newValue,
    bool trackChanges,
    RegexOptions options
)
Visual Basic (Declaration)
Public Sub ReplaceText ( _
    oldValue As String, _
    newValue As String, _
    trackChanges As Boolean, _
    options As RegexOptions _
)
Visual C++
public:
void ReplaceText(
    String^ oldValue,
    String^ newValue,
    bool trackChanges,
    RegexOptions options
)

Parameters

oldValue
Type: System..::.String
A System.String to be replaced.
newValue
Type: System..::.String
A System.String to replace all occurances of oldValue.
trackChanges
Type: System..::.Boolean
Track changes
options
Type: System.Text.RegularExpressions..::.RegexOptions
A bitwise OR combination of RegexOption enumeration options.

Examples

CopyC#
// Create a document using a relative filename.
using (DocX document = DocX.Load(@"C:\Example\Test.docx"))
{
    // Iterate through the paragraphs in this document.
    foreach (Paragraph p in document.Paragraphs)
    {
        // Replace all instances of the string "wrong" with the string "right" and ignore case.
        p.ReplaceText("wrong", "right", false, RegexOptions.IgnoreCase);
    }

    // Save all changes made to this document.
    document.Save();
}// Release this document from memory.

See Also

Paragraph Class
ReplaceText Overload
Novacode Namespace
Paragraph..::.RemoveText(Int32, Int32, Boolean)
Paragraph..::.RemoveText(Int32, Boolean)
Paragraph..::.InsertText(String, Boolean)
Paragraph..::.InsertText(Int32, String, Boolean)
Paragraph..::.InsertText(Int32, String, Boolean, Formatting)
Paragraph..::.InsertText(String, Boolean, Formatting)


ReplaceText Method (String, String, Boolean, RegexOptions, Formatting)

[image]

A Sandcastle Documented Class Library
Paragraph..::.ReplaceText Method (String, String, Boolean, RegexOptions, Formatting)
Paragraph Class Example See Also Send Feedback
Replaces all occurrences of a specified System.String in this instance, with another specified System.String.

Namespace: Novacode
Assembly: DocX (in DocX.dll) Version: 1.0.0.7 (1.0.0.7)

Syntax

C#
public void ReplaceText(
    string oldValue,
    string newValue,
    bool trackChanges,
    RegexOptions options,
    Formatting newFormatting
)
Visual Basic (Declaration)
Public Sub ReplaceText ( _
    oldValue As String, _
    newValue As String, _
    trackChanges As Boolean, _
    options As RegexOptions, _
    newFormatting As Formatting _
)
Visual C++
public:
void ReplaceText(
    String^ oldValue,
    String^ newValue,
    bool trackChanges,
    RegexOptions options,
    Formatting^ newFormatting
)

Parameters

oldValue
Type: System..::.String
A System.String to be replaced.
newValue
Type: System..::.String
A System.String to replace all occurances of oldValue.
trackChanges
Type: System..::.Boolean
Track changes
options
Type: System.Text.RegularExpressions..::.RegexOptions
A bitwise OR combination of RegexOption enumeration options.
newFormatting
Type: Novacode..::.Formatting
The formatting to apply to the text being inserted.

Examples

CopyC#
// Create a document using a relative filename.
using (DocX document = DocX.Load(@"C:\Example\Test.docx"))
{
    // The formatting to apply to the inserted text.
    Formatting newFormatting = new Formatting();
    newFormatting.Size = 22;
    newFormatting.UnderlineStyle = UnderlineStyle.dotted;
    newFormatting.Bold = true;

    // Iterate through the paragraphs in this document.
    foreach (Paragraph p in document.Paragraphs)
    {
        /*
         * Replace all instances of the string "wrong" with the string "right" and ignore case.
         * Each inserted instance of "wrong" should use the Formatting newFormatting.
         */
        p.ReplaceText("wrong", "right", false, RegexOptions.IgnoreCase, newFormatting);
    }

    // Save all changes made to this document.
    document.Save();
}// Release this document from memory.

See Also

Paragraph Class
ReplaceText Overload
Novacode Namespace
Paragraph..::.RemoveText(Int32, Int32, Boolean)
Paragraph..::.RemoveText(Int32, Boolean)
Paragraph..::.InsertText(String, Boolean)
Paragraph..::.InsertText(Int32, String, Boolean)
Paragraph..::.InsertText(Int32, String, Boolean, Formatting)
Paragraph..::.InsertText(String, Boolean, Formatting)


ReplaceText Method (String, String, Boolean, RegexOptions, Formatting, Formatting, MatchFormattingOptions)

[image]

A Sandcastle Documented Class Library
Paragraph..::.ReplaceText Method (String, String, Boolean, RegexOptions, Formatting, Formatting, MatchFormattingOptions)
Paragraph Class Example See Also Send Feedback
Replaces all occurrences of a specified System.String in this instance, with another specified System.String.

Namespace: Novacode
Assembly: DocX (in DocX.dll) Version: 1.0.0.7 (1.0.0.7)

Syntax

C#
public void ReplaceText(
    string oldValue,
    string newValue,
    bool trackChanges,
    RegexOptions options,
    Formatting newFormatting,
    Formatting matchFormatting,
    MatchFormattingOptions fo
)
Visual Basic (Declaration)
Public Sub ReplaceText ( _
    oldValue As String, _
    newValue As String, _
    trackChanges As Boolean, _
    options As RegexOptions, _
    newFormatting As Formatting, _
    matchFormatting As Formatting, _
    fo As MatchFormattingOptions _
)
Visual C++
public:
void ReplaceText(
    String^ oldValue,
    String^ newValue,
    bool trackChanges,
    RegexOptions options,
    Formatting^ newFormatting,
    Formatting^ matchFormatting,
    MatchFormattingOptions fo
)

Parameters

oldValue
Type: System..::.String
A System.String to be replaced.
newValue
Type: System..::.String
A System.String to replace all occurances of oldValue.
trackChanges
Type: System..::.Boolean
Track changes
options
Type: System.Text.RegularExpressions..::.RegexOptions
A bitwise OR combination of RegexOption enumeration options.
newFormatting
Type: Novacode..::.Formatting
The formatting to apply to the text being inserted.
matchFormatting
Type: Novacode..::.Formatting
The formatting that the text must match in order to be replaced.
fo
Type: Novacode..::.MatchFormattingOptions
How should formatting be matched?

Examples

CopyC#
// Load a document using a relative filename.
using (DocX document = DocX.Load(@"C:\Example\Test.docx"))
{
    // The formatting to match.
    Formatting matchFormatting = new Formatting();
    matchFormatting.Size = 10;
    matchFormatting.Italic = true;
    matchFormatting.FontFamily = new FontFamily("Times New Roman");

    // The formatting to apply to the inserted text.
    Formatting newFormatting = new Formatting();
    newFormatting.Size = 22;
    newFormatting.UnderlineStyle = UnderlineStyle.dotted;
    newFormatting.Bold = true;

    // Iterate through the paragraphs in this document.
    foreach (Paragraph p in document.Paragraphs)
    {
        /*
         * Replace all instances of the string "wrong" with the string "right" and ignore case.
         * Each inserted instance of "wrong" should use the Formatting newFormatting.
         * Only replace an instance of "wrong" if it is Size 10, Italic and Times New Roman.
         * SubsetMatch means that the formatting must contain all elements of the match formatting,
         * but it can also contain additional formatting for example Color, UnderlineStyle, etc.
         * ExactMatch means it must not contain additional formatting.
         */
        p.ReplaceText("wrong", "right", false, RegexOptions.IgnoreCase, newFormatting, matchFormatting, MatchFormattingOptions.SubsetMatch);
    }

    // Save all changes made to this document.
    document.Save();
}// Release this document from memory.

See Also

Paragraph Class
ReplaceText Overload
Novacode Namespace
Paragraph..::.RemoveText(Int32, Int32, Boolean)
Paragraph..::.RemoveText(Int32, Boolean)
Paragraph..::.InsertText(String, Boolean)
Paragraph..::.InsertText(Int32, String, Boolean)
Paragraph..::.InsertText(Int32, String, Boolean, Formatting)
Paragraph..::.InsertText(String, Boolean, Formatting)


Script Method

[image]

A Sandcastle Documented Class Library
Paragraph..::.Script Method
Paragraph Class Example See Also Send Feedback
For use with Append() and AppendLine()

Namespace: Novacode
Assembly: DocX (in DocX.dll) Version: 1.0.0.7 (1.0.0.7)

Syntax

C#
public Paragraph Script(
    Script script
)
Visual Basic (Declaration)
Public Function Script ( _
    script As Script _
) As Paragraph
Visual C++
public:
Paragraph^ Script(
    Script script
)

Parameters

script
Type: Novacode..::.Script
The script style to apply to the last appended text.

Return Value

This Paragraph with the last appended text's script style changed.

Examples

Append text to this Paragraph and then set it to superscript.
CopyC#
// Create a document.
using (DocX document = DocX.Create(@"Test.docx"))
{
    // Insert a new Paragraph.
    Paragraph p = document.InsertParagraph();

    p.Append("I am ")
    .Append("superscript").Script(Script.superscript)
    .Append(" I am not");

    // Save this document.
    document.Save();
}// Release this document from memory.

See Also

Paragraph Class


Spacing Method

[image]

A Sandcastle Documented Class Library
Paragraph..::.Spacing Method
Paragraph Class See Also Send Feedback

[Missing <summary> documentation for "M:Novacode.Paragraph.Spacing(System.Double)"]

Namespace: Novacode
Assembly: DocX (in DocX.dll) Version: 1.0.0.7 (1.0.0.7)

Syntax

C#
public Paragraph Spacing(
    double spacing
)
Visual Basic (Declaration)
Public Function Spacing ( _
    spacing As Double _
) As Paragraph
Visual C++
public:
Paragraph^ Spacing(
    double spacing
)

Parameters

spacing
Type: System..::.Double

[Missing <param name="spacing"/> documentation for "M:Novacode.Paragraph.Spacing(System.Double)"]

Return Value

[Missing <returns> documentation for "M:Novacode.Paragraph.Spacing(System.Double)"]

See Also

Paragraph Class


StrikeThrough Method

[image]

A Sandcastle Documented Class Library
Paragraph..::.StrikeThrough Method
Paragraph Class Example See Also Send Feedback
For use with Append() and AppendLine()

Namespace: Novacode
Assembly: DocX (in DocX.dll) Version: 1.0.0.7 (1.0.0.7)

Syntax

C#
public Paragraph StrikeThrough(
    StrikeThrough strikeThrough
)
Visual Basic (Declaration)
Public Function StrikeThrough ( _
    strikeThrough As StrikeThrough _
) As Paragraph
Visual C++
public:
Paragraph^ StrikeThrough(
    StrikeThrough strikeThrough
)

Parameters

strikeThrough
Type: Novacode..::.StrikeThrough
The strike through style to used on the last appended text.

Return Value

This Paragraph with the last appended text striked.

Examples

Append text to this Paragraph and then strike it.
CopyC#
// Create a document.
using (DocX document = DocX.Create(@"Test.docx"))
{
    // Insert a new Paragraph.
    Paragraph p = document.InsertParagraph();

    p.Append("I am ")
    .Append("striked").StrikeThrough(StrikeThrough.doubleStrike)
    .Append(" I am not");

    // Save this document.
    document.Save();
}// Release this document from memory.

See Also

Paragraph Class


UnderlineColor Method

[image]

A Sandcastle Documented Class Library
Paragraph..::.UnderlineColor Method
Paragraph Class Example See Also Send Feedback
For use with Append() and AppendLine()

Namespace: Novacode
Assembly: DocX (in DocX.dll) Version: 1.0.0.7 (1.0.0.7)

Syntax

C#
public Paragraph UnderlineColor(
    Color underlineColor
)
Visual Basic (Declaration)
Public Function UnderlineColor ( _
    underlineColor As Color _
) As Paragraph
Visual C++
public:
Paragraph^ UnderlineColor(
    Color underlineColor
)

Parameters

underlineColor
Type: System.Drawing..::.Color
The underline color to use, if no underline is set, a single line will be used.

Return Value

This Paragraph with the last appended text underlined in a color.

Examples

Append text to this Paragraph and then underline it using a color.
CopyC#
// Create a document.
using (DocX document = DocX.Create(@"Test.docx"))
{
    // Insert a new Paragraph.
    Paragraph p = document.InsertParagraph();

    p.Append("I am ")
    .Append("color underlined").UnderlineStyle(UnderlineStyle.dotted).UnderlineColor(Color.Orange)
    .Append(" I am not");

    // Save this document.
    document.Save();
}// Release this document from memory.

See Also

Paragraph Class


UnderlineStyle Method

[image]

A Sandcastle Documented Class Library
Paragraph..::.UnderlineStyle Method
Paragraph Class Example See Also Send Feedback
For use with Append() and AppendLine()

Namespace: Novacode
Assembly: DocX (in DocX.dll) Version: 1.0.0.7 (1.0.0.7)

Syntax

C#
public Paragraph UnderlineStyle(
    UnderlineStyle underlineStyle
)
Visual Basic (Declaration)
Public Function UnderlineStyle ( _
    underlineStyle As UnderlineStyle _
) As Paragraph
Visual C++
public:
Paragraph^ UnderlineStyle(
    UnderlineStyle underlineStyle
)

Parameters

underlineStyle
Type: Novacode..::.UnderlineStyle
The underline style to use for the appended text.

Return Value

This Paragraph with the last appended text underlined.

Examples

Append text to this Paragraph and then underline it.
CopyC#
// Create a document.
using (DocX document = DocX.Create(@"Test.docx"))
{
    // Insert a new Paragraph.
    Paragraph p = document.InsertParagraph();

    p.Append("I am ")
    .Append("Underlined").UnderlineStyle(UnderlineStyle.doubleLine)
    .Append(" I am not");

    // Save this document.
    document.Save();
}// Release this document from memory.

See Also

Paragraph Class


Paragraph Properties

[image] [image]

A Sandcastle Documented Class Library
Paragraph Properties
Paragraph Class See Also Send Feedback

The Paragraph type exposes the following members.

Properties

Name | Description
Alignment | Gets or set this Paragraphs text alignment.
DocumentProperties | Returns a list of field type DocProperty in this document.
Pictures | Returns a list of Pictures in this Paragraph.
Text | Gets the text value of this Paragraph.

See Also

Paragraph Class


Alignment Property

[image]

A Sandcastle Documented Class Library
Paragraph..::.Alignment Property
Paragraph Class See Also Send Feedback
Gets or set this Paragraphs text alignment.

Namespace: Novacode
Assembly: DocX (in DocX.dll) Version: 1.0.0.7 (1.0.0.7)

Syntax

C#
public Alignment Alignment { get; set; }
Visual Basic (Declaration)
Public Property Alignment As Alignment
Visual C++
public:
property Alignment Alignment {
    Alignment get ();
    void set (Alignment value);
}

See Also

Paragraph Class


DocumentProperties Property

[image]

A Sandcastle Documented Class Library
Paragraph..::.DocumentProperties Property
Paragraph Class See Also Send Feedback
Returns a list of field type DocProperty in this document.

Namespace: Novacode
Assembly: DocX (in DocX.dll) Version: 1.0.0.7 (1.0.0.7)

Syntax

C#
public List<DocProperty> DocumentProperties { get; }
Visual Basic (Declaration)
Public ReadOnly Property DocumentProperties As List(Of DocProperty)
Visual C++
public:
property List<DocProperty^>^ DocumentProperties {
    List<DocProperty^>^ get ();
}

See Also

Paragraph Class


Pictures Property

[image]

A Sandcastle Documented Class Library
Paragraph..::.Pictures Property
Paragraph Class See Also Send Feedback
Returns a list of Pictures in this Paragraph.

Namespace: Novacode
Assembly: DocX (in DocX.dll) Version: 1.0.0.7 (1.0.0.7)

Syntax

C#
public List<Picture> Pictures { get; }
Visual Basic (Declaration)
Public ReadOnly Property Pictures As List(Of Picture)
Visual C++
public:
property List<Picture^>^ Pictures {
    List<Picture^>^ get ();
}

See Also

Paragraph Class


Text Property

[image]

A Sandcastle Documented Class Library
Paragraph..::.Text Property
Paragraph Class See Also Send Feedback
Gets the text value of this Paragraph.

Namespace: Novacode
Assembly: DocX (in DocX.dll) Version: 1.0.0.7 (1.0.0.7)

Syntax

C#
public string Text { get; }
Visual Basic (Declaration)
Public ReadOnly Property Text As String
Visual C++
public:
property String^ Text {
    String^ get ();
}

See Also

Paragraph Class


Picture Class

[image]

A Sandcastle Documented Class Library
Picture Class
Members See Also Send Feedback
Represents a Picture in this document, a Picture is a customized view of an Image.

Namespace: Novacode
Assembly: DocX (in DocX.dll) Version: 1.0.0.7 (1.0.0.7)

Syntax

C#
public class Picture
Visual Basic (Declaration)
Public Class Picture
Visual C++
public ref class Picture

Inheritance Hierarchy

System..::.Object
Novacode..::.Picture

See Also

Picture Members


Picture Members

[image] [image]

A Sandcastle Documented Class Library
Picture Members
Picture Class Methods Properties See Also Send Feedback

The Picture type exposes the following members.

Methods

Name | Description
Remove | Remove this Picture from this document.
SetPictureShape | Overloaded.

Properties

Name | Description
Description | Gets or sets the description for this Image.
FlipHorizontal | Flip this Picture Horizontally.
FlipVertical | Flip this Picture Vertically.
Height | Get or sets the height of this Image.
Id | A unique id that identifies an Image embedded in this document.
Name | Gets or sets the name of this Image.
Rotation | The rotation in degrees of this image, actual value = value % 360
Width | Get or sets the Width of this Image.

See Also

Picture Class


Picture Methods

[image] [image]

A Sandcastle Documented Class Library
Picture Methods
Picture Class See Also Send Feedback

The Picture type exposes the following members.

Methods

Name | Description
Remove | Remove this Picture from this document.
SetPictureShape | Overloaded.

See Also

Picture Class


Remove Method

[image]

A Sandcastle Documented Class Library
Picture..::.Remove Method
Picture Class See Also Send Feedback
Remove this Picture from this document.

Namespace: Novacode
Assembly: DocX (in DocX.dll) Version: 1.0.0.7 (1.0.0.7)

Syntax

C#
public void Remove()
Visual Basic (Declaration)
Public Sub Remove
Visual C++
public:
void Remove()

See Also

Picture Class


SetPictureShape Method

[image] [image]

A Sandcastle Documented Class Library
Picture..::.SetPictureShape Method
Picture Class See Also Send Feedback

Overload List

Name | Description
SetPictureShape(BasicShapes) | Set the shape of this Picture to one in the BasicShapes enumeration.
SetPictureShape(BlockArrowShapes) | Set the shape of this Picture to one in the BlockArrowShapes enumeration.
SetPictureShape(CalloutShapes) | Set the shape of this Picture to one in the CalloutShapes enumeration.
SetPictureShape(EquationShapes) | Set the shape of this Picture to one in the EquationShapes enumeration.
SetPictureShape(FlowchartShapes) | Set the shape of this Picture to one in the FlowchartShapes enumeration.
SetPictureShape(RectangleShapes) | Set the shape of this Picture to one in the RectangleShapes enumeration.
SetPictureShape(StarAndBannerShapes) | Set the shape of this Picture to one in the StarAndBannerShapes enumeration.

See Also

Picture Class
Picture Members


SetPictureShape Method (BasicShapes)

[image]

A Sandcastle Documented Class Library
Picture..::.SetPictureShape Method (BasicShapes)
Picture Class See Also Send Feedback
Set the shape of this Picture to one in the BasicShapes enumeration.

Namespace: Novacode
Assembly: DocX (in DocX.dll) Version: 1.0.0.7 (1.0.0.7)

Syntax

C#
public void SetPictureShape(
    BasicShapes shape
)
Visual Basic (Declaration)
Public Sub SetPictureShape ( _
    shape As BasicShapes _
)
Visual C++
public:
void SetPictureShape(
    BasicShapes shape
)

Parameters

shape
Type: Novacode..::.BasicShapes
A shape from the BasicShapes enumeration.

See Also

Picture Class
SetPictureShape Overload


SetPictureShape Method (BlockArrowShapes)

[image]

A Sandcastle Documented Class Library
Picture..::.SetPictureShape Method (BlockArrowShapes)
Picture Class See Also Send Feedback
Set the shape of this Picture to one in the BlockArrowShapes enumeration.

Namespace: Novacode
Assembly: DocX (in DocX.dll) Version: 1.0.0.7 (1.0.0.7)

Syntax

C#
public void SetPictureShape(
    BlockArrowShapes shape
)
Visual Basic (Declaration)
Public Sub SetPictureShape ( _
    shape As BlockArrowShapes _
)
Visual C++
public:
void SetPictureShape(
    BlockArrowShapes shape
)

Parameters

shape
Type: Novacode..::.BlockArrowShapes
A shape from the BlockArrowShapes enumeration.

See Also

Picture Class
SetPictureShape Overload


SetPictureShape Method (CalloutShapes)

[image]

A Sandcastle Documented Class Library
Picture..::.SetPictureShape Method (CalloutShapes)
Picture Class See Also Send Feedback
Set the shape of this Picture to one in the CalloutShapes enumeration.

Namespace: Novacode
Assembly: DocX (in DocX.dll) Version: 1.0.0.7 (1.0.0.7)

Syntax

C#
public void SetPictureShape(
    CalloutShapes shape
)
Visual Basic (Declaration)
Public Sub SetPictureShape ( _
    shape As CalloutShapes _
)
Visual C++
public:
void SetPictureShape(
    CalloutShapes shape
)

Parameters

shape
Type: Novacode..::.CalloutShapes
A shape from the CalloutShapes enumeration.

See Also

Picture Class
SetPictureShape Overload


SetPictureShape Method (EquationShapes)

[image]

A Sandcastle Documented Class Library
Picture..::.SetPictureShape Method (EquationShapes)
Picture Class See Also Send Feedback
Set the shape of this Picture to one in the EquationShapes enumeration.

Namespace: Novacode
Assembly: DocX (in DocX.dll) Version: 1.0.0.7 (1.0.0.7)

Syntax

C#
public void SetPictureShape(
    EquationShapes shape
)
Visual Basic (Declaration)
Public Sub SetPictureShape ( _
    shape As EquationShapes _
)
Visual C++
public:
void SetPictureShape(
    EquationShapes shape
)

Parameters

shape
Type: Novacode..::.EquationShapes
A shape from the EquationShapes enumeration.

See Also

Picture Class
SetPictureShape Overload


SetPictureShape Method (FlowchartShapes)

[image]

A Sandcastle Documented Class Library
Picture..::.SetPictureShape Method (FlowchartShapes)
Picture Class See Also Send Feedback
Set the shape of this Picture to one in the FlowchartShapes enumeration.

Namespace: Novacode
Assembly: DocX (in DocX.dll) Version: 1.0.0.7 (1.0.0.7)

Syntax

C#
public void SetPictureShape(
    FlowchartShapes shape
)
Visual Basic (Declaration)
Public Sub SetPictureShape ( _
    shape As FlowchartShapes _
)
Visual C++
public:
void SetPictureShape(
    FlowchartShapes shape
)

Parameters

shape
Type: Novacode..::.FlowchartShapes
A shape from the FlowchartShapes enumeration.

See Also

Picture Class
SetPictureShape Overload


SetPictureShape Method (RectangleShapes)

[image]

A Sandcastle Documented Class Library
Picture..::.SetPictureShape Method (RectangleShapes)
Picture Class See Also Send Feedback
Set the shape of this Picture to one in the RectangleShapes enumeration.

Namespace: Novacode
Assembly: DocX (in DocX.dll) Version: 1.0.0.7 (1.0.0.7)

Syntax

C#
public void SetPictureShape(
    RectangleShapes shape
)
Visual Basic (Declaration)
Public Sub SetPictureShape ( _
    shape As RectangleShapes _
)
Visual C++
public:
void SetPictureShape(
    RectangleShapes shape
)

Parameters

shape
Type: Novacode..::.RectangleShapes
A shape from the RectangleShapes enumeration.

See Also

Picture Class
SetPictureShape Overload


SetPictureShape Method (StarAndBannerShapes)

[image]

A Sandcastle Documented Class Library
Picture..::.SetPictureShape Method (StarAndBannerShapes)
Picture Class See Also Send Feedback
Set the shape of this Picture to one in the StarAndBannerShapes enumeration.

Namespace: Novacode
Assembly: DocX (in DocX.dll) Version: 1.0.0.7 (1.0.0.7)

Syntax

C#
public void SetPictureShape(
    StarAndBannerShapes shape
)
Visual Basic (Declaration)
Public Sub SetPictureShape ( _
    shape As StarAndBannerShapes _
)
Visual C++
public:
void SetPictureShape(
    StarAndBannerShapes shape
)

Parameters

shape
Type: Novacode..::.StarAndBannerShapes
A shape from the StarAndBannerShapes enumeration.

See Also

Picture Class
SetPictureShape Overload


Picture Properties

[image] [image]

A Sandcastle Documented Class Library
Picture Properties
Picture Class See Also Send Feedback

The Picture type exposes the following members.

Properties

Name | Description
Description | Gets or sets the description for this Image.
FlipHorizontal | Flip this Picture Horizontally.
FlipVertical | Flip this Picture Vertically.
Height | Get or sets the height of this Image.
Id | A unique id that identifies an Image embedded in this document.
Name | Gets or sets the name of this Image.
Rotation | The rotation in degrees of this image, actual value = value % 360
Width | Get or sets the Width of this Image.

See Also

Picture Class


Description Property

[image]

A Sandcastle Documented Class Library
Picture..::.Description Property
Picture Class See Also Send Feedback
Gets or sets the description for this Image.

Namespace: Novacode
Assembly: DocX (in DocX.dll) Version: 1.0.0.7 (1.0.0.7)

Syntax

C#
public string Description { get; set; }
Visual Basic (Declaration)
Public Property Description As String
Visual C++
public:
property String^ Description {
    String^ get ();
    void set (String^ value);
}

See Also

Picture Class


FlipHorizontal Property

[image]

A Sandcastle Documented Class Library
Picture..::.FlipHorizontal Property
Picture Class See Also Send Feedback
Flip this Picture Horizontally.

Namespace: Novacode
Assembly: DocX (in DocX.dll) Version: 1.0.0.7 (1.0.0.7)

Syntax

C#
public bool FlipHorizontal { get; set; }
Visual Basic (Declaration)
Public Property FlipHorizontal As Boolean
Visual C++
public:
property bool FlipHorizontal {
    bool get ();
    void set (bool value);
}

See Also

Picture Class


FlipVertical Property

[image]

A Sandcastle Documented Class Library
Picture..::.FlipVertical Property
Picture Class See Also Send Feedback
Flip this Picture Vertically.

Namespace: Novacode
Assembly: DocX (in DocX.dll) Version: 1.0.0.7 (1.0.0.7)

Syntax

C#
public bool FlipVertical { get; set; }
Visual Basic (Declaration)
Public Property FlipVertical As Boolean
Visual C++
public:
property bool FlipVertical {
    bool get ();
    void set (bool value);
}

See Also

Picture Class


Height Property

[image]

A Sandcastle Documented Class Library
Picture..::.Height Property
Picture Class See Also Send Feedback
Get or sets the height of this Image.

Namespace: Novacode
Assembly: DocX (in DocX.dll) Version: 1.0.0.7 (1.0.0.7)

Syntax

C#
public int Height { get; set; }
Visual Basic (Declaration)
Public Property Height As Integer
Visual C++
public:
property int Height {
    int get ();
    void set (int value);
}

See Also

Picture Class


Id Property

[image]

A Sandcastle Documented Class Library
Picture..::.Id Property
Picture Class See Also Send Feedback
A unique id that identifies an Image embedded in this document.

Namespace: Novacode
Assembly: DocX (in DocX.dll) Version: 1.0.0.7 (1.0.0.7)

Syntax

C#
public string Id { get; }
Visual Basic (Declaration)
Public ReadOnly Property Id As String
Visual C++
public:
property String^ Id {
    String^ get ();
}

See Also

Picture Class


Name Property

[image]

A Sandcastle Documented Class Library
Picture..::.Name Property
Picture Class See Also Send Feedback
Gets or sets the name of this Image.

Namespace: Novacode
Assembly: DocX (in DocX.dll) Version: 1.0.0.7 (1.0.0.7)

Syntax

C#
public string Name { get; set; }
Visual Basic (Declaration)
Public Property Name As String
Visual C++
public:
property String^ Name {
    String^ get ();
    void set (String^ value);
}

See Also

Picture Class


Rotation Property

[image]

A Sandcastle Documented Class Library
Picture..::.Rotation Property
Picture Class See Also Send Feedback
The rotation in degrees of this image, actual value = value % 360

Namespace: Novacode
Assembly: DocX (in DocX.dll) Version: 1.0.0.7 (1.0.0.7)

Syntax

C#
public uint Rotation { get; set; }
Visual Basic (Declaration)
Public Property Rotation As UInteger
Visual C++
public:
property unsigned int Rotation {
    unsigned int get ();
    void set (unsigned int value);
}

See Also

Picture Class


Width Property

[image]

A Sandcastle Documented Class Library
Picture..::.Width Property
Picture Class See Also Send Feedback
Get or sets the Width of this Image.

Namespace: Novacode
Assembly: DocX (in DocX.dll) Version: 1.0.0.7 (1.0.0.7)

Syntax

C#
public int Width { get; set; }
Visual Basic (Declaration)
Public Property Width As Integer
Visual C++
public:
property int Width {
    int get ();
    void set (int value);
}

See Also

Picture Class


RectangleShapes Enumeration

[image]

A Sandcastle Documented Class Library
RectangleShapes Enumeration
See Also Send Feedback

[Missing <summary> documentation for "T:Novacode.RectangleShapes"]

Namespace: Novacode
Assembly: DocX (in DocX.dll) Version: 1.0.0.7 (1.0.0.7)

Syntax

C#
public enum RectangleShapes
Visual Basic (Declaration)
Public Enumeration RectangleShapes
Visual C++
public enum class RectangleShapes

Members

Member name | Description
rect |
roundRect |
snip1Rect |
snip2SameRect |
snip2DiagRect |
snipRoundRect |
round1Rect |
round2SameRect |
round2DiagRect |

See Also

Novacode Namespace


Row Class

[image]

A Sandcastle Documented Class Library
Row Class
Members See Also Send Feedback
Represents a single row in a Table.

Namespace: Novacode
Assembly: DocX (in DocX.dll) Version: 1.0.0.7 (1.0.0.7)

Syntax

C#
public class Row
Visual Basic (Declaration)
Public Class Row
Visual C++
public ref class Row

Inheritance Hierarchy

System..::.Object
Novacode..::.Row

See Also

Row Members


Row Members

[image] [image]

A Sandcastle Documented Class Library
Row Members
Row Class Methods Properties See Also Send Feedback

The Row type exposes the following members.

Methods

Name | Description
MergeCells | Merge cells starting with startIndex and ending with endIndex.

Properties

Name | Description
Cells | A list of Cells in this Row.
Height | Height in pixels. // Added by Joel, refactored by Cathal.

See Also

Row Class


Row Methods

[image] [image]

A Sandcastle Documented Class Library
Row Methods
Row Class See Also Send Feedback

The Row type exposes the following members.

Methods

Name | Description
MergeCells | Merge cells starting with startIndex and ending with endIndex.

See Also

Row Class


MergeCells Method

[image]

A Sandcastle Documented Class Library
Row..::.MergeCells Method
Row Class See Also Send Feedback
Merge cells starting with startIndex and ending with endIndex.

Namespace: Novacode
Assembly: DocX (in DocX.dll) Version: 1.0.0.7 (1.0.0.7)

Syntax

C#
public void MergeCells(
    int startIndex,
    int endIndex
)
Visual Basic (Declaration)
Public Sub MergeCells ( _
    startIndex As Integer, _
    endIndex As Integer _
)
Visual C++
public:
void MergeCells(
    int startIndex,
    int endIndex
)

Parameters

startIndex
Type: System..::.Int32

[Missing <param name="startIndex"/> documentation for "M:Novacode.Row.MergeCells(System.Int32,System.Int32)"]

endIndex
Type: System..::.Int32

[Missing <param name="endIndex"/> documentation for "M:Novacode.Row.MergeCells(System.Int32,System.Int32)"]

See Also

Row Class


Row Properties

[image] [image]

A Sandcastle Documented Class Library
Row Properties
Row Class See Also Send Feedback

The Row type exposes the following members.

Properties

Name | Description
Cells | A list of Cells in this Row.
Height | Height in pixels. // Added by Joel, refactored by Cathal.

See Also

Row Class


Cells Property

[image]

A Sandcastle Documented Class Library
Row..::.Cells Property
Row Class See Also Send Feedback
A list of Cells in this Row.

Namespace: Novacode
Assembly: DocX (in DocX.dll) Version: 1.0.0.7 (1.0.0.7)

Syntax

C#
public List<Cell> Cells { get; }
Visual Basic (Declaration)
Public ReadOnly Property Cells As List(Of Cell)
Visual C++
public:
property List<Cell^>^ Cells {
    List<Cell^>^ get ();
}

See Also

Row Class


Height Property

[image]

A Sandcastle Documented Class Library
Row..::.Height Property
Row Class See Also Send Feedback
Height in pixels. // Added by Joel, refactored by Cathal.

Namespace: Novacode
Assembly: DocX (in DocX.dll) Version: 1.0.0.7 (1.0.0.7)

Syntax

C#
public double Height { get; set; }
Visual Basic (Declaration)
Public Property Height As Double
Visual C++
public:
property double Height {
    double get ();
    void set (double value);
}

See Also

Row Class


RunTextType Enumeration

[image]

A Sandcastle Documented Class Library
RunTextType Enumeration
See Also Send Feedback
Text types in a Run

Namespace: Novacode
Assembly: DocX (in DocX.dll) Version: 1.0.0.7 (1.0.0.7)

Syntax

C#
public enum RunTextType
Visual Basic (Declaration)
Public Enumeration RunTextType
Visual C++
public enum class RunTextType

Members

Member name | Description
Text | System.String
DelText | System.String

See Also

Novacode Namespace


Script Enumeration

[image]

A Sandcastle Documented Class Library
Script Enumeration
See Also Send Feedback

[Missing <summary> documentation for "T:Novacode.Script"]

Namespace: Novacode
Assembly: DocX (in DocX.dll) Version: 1.0.0.7 (1.0.0.7)

Syntax

C#
public enum Script
Visual Basic (Declaration)
Public Enumeration Script
Visual C++
public enum class Script

Members

Member name | Description
superscript |
subscript |
none |

See Also

Novacode Namespace


StarAndBannerShapes Enumeration

[image]

A Sandcastle Documented Class Library
StarAndBannerShapes Enumeration
See Also Send Feedback

[Missing <summary> documentation for "T:Novacode.StarAndBannerShapes"]

Namespace: Novacode
Assembly: DocX (in DocX.dll) Version: 1.0.0.7 (1.0.0.7)

Syntax

C#
public enum StarAndBannerShapes
Visual Basic (Declaration)
Public Enumeration StarAndBannerShapes
Visual C++
public enum class StarAndBannerShapes

Members

Member name | Description
irregularSeal1 |
irregularSeal2 |
star4 |
star5 |
star6 |
star7 |
star8 |
star10 |
star12 |
star16 |
star24 |
star32 |
ribbon |
ribbon2 |
ellipseRibbon |
ellipseRibbon2 |
verticalScroll |
horizontalScroll |
wave |
doubleWave |

See Also

Novacode Namespace


StrikeThrough Enumeration

[image]

A Sandcastle Documented Class Library
StrikeThrough Enumeration
See Also Send Feedback

[Missing <summary> documentation for "T:Novacode.StrikeThrough"]

Namespace: Novacode
Assembly: DocX (in DocX.dll) Version: 1.0.0.7 (1.0.0.7)

Syntax

C#
public enum StrikeThrough
Visual Basic (Declaration)
Public Enumeration StrikeThrough
Visual C++
public enum class StrikeThrough

Members

Member name | Description
none |
strike |
doubleStrike |

See Also

Novacode Namespace


Table Class

[image]

A Sandcastle Documented Class Library
Table Class
Members See Also Send Feedback
Represents a Table in a document.

Namespace: Novacode
Assembly: DocX (in DocX.dll) Version: 1.0.0.7 (1.0.0.7)

Syntax

C#
public class Table
Visual Basic (Declaration)
Public Class Table
Visual C++
public ref class Table

Inheritance Hierarchy

System..::.Object
Novacode..::.Table

See Also

Table Members


Table Members

[image] [image]

A Sandcastle Documented Class Library
Table Members
Table Class Methods Properties See Also Send Feedback

The Table type exposes the following members.

Methods

Name | Description
InsertColumn | Overloaded.
InsertPageBreakAfterSelf | Insert a page break after a Table.
InsertPageBreakBeforeSelf | Insert a page break before a Table.
InsertParagraphAfterSelf | Overloaded.
InsertParagraphBeforeSelf | Overloaded.
InsertRow | Overloaded.
InsertTableAfterSelf | Overloaded.
InsertTableBeforeSelf | Overloaded.
Remove | Remove this Table from this document.
RemoveColumn | Overloaded.
RemoveRow | Overloaded.

Properties

Name | Description
Alignment |
AutoFit | Auto size this table according to some rule.
ColumnCount | Returns the number of coloumns in this table.
Design | The design\style to apply to this table.
Index | Returns the index of this Table.
RowCount | Returns the number of rows in this table.
Rows | Returns a list of rows in this table.

See Also

Table Class


Table Methods

[image] [image]

A Sandcastle Documented Class Library
Table Methods
Table Class See Also Send Feedback

The Table type exposes the following members.

Methods

Name | Description
InsertColumn | Overloaded.
InsertPageBreakAfterSelf | Insert a page break after a Table.
InsertPageBreakBeforeSelf | Insert a page break before a Table.
InsertParagraphAfterSelf | Overloaded.
InsertParagraphBeforeSelf | Overloaded.
InsertRow | Overloaded.
InsertTableAfterSelf | Overloaded.
InsertTableBeforeSelf | Overloaded.
Remove | Remove this Table from this document.
RemoveColumn | Overloaded.
RemoveRow | Overloaded.

See Also

Table Class


InsertColumn Method

[image] [image]

A Sandcastle Documented Class Library
Table..::.InsertColumn Method
Table Class See Also Send Feedback

Overload List

Name | Description
InsertColumn()()() | Insert a column to the right of a Table.
InsertColumn(Int32) | Insert a column into a table.

See Also

Table Class
Table Members


InsertColumn Method

[image]

A Sandcastle Documented Class Library
Table..::.InsertColumn Method
Table Class Example See Also Send Feedback
Insert a column to the right of a Table.

Namespace: Novacode
Assembly: DocX (in DocX.dll) Version: 1.0.0.7 (1.0.0.7)

Syntax

C#
public void InsertColumn()
Visual Basic (Declaration)
Public Sub InsertColumn
Visual C++
public:
void InsertColumn()

Examples

CopyC#
// Load a document.
using (DocX document = DocX.Load(@"C:\Example\Test.docx"))
{
    // Get the first Table in this document.
    Table table = document.Tables[0];

    // Insert a new column to this right of this table.
    table.InsertColumn();

    // Set the new coloumns text to "Row no."
    table.Rows[0].Cells[table.ColumnCount - 1].Paragraph.InsertText("Row no.", false);

    // Loop through each row in the table.
    for (int i = 1; i < table.Rows.Count; i++)
    {
        // The current row.
        Row row = table.Rows[i];

        // The cell in this row that belongs to the new coloumn.
        Cell cell = row.Cells[table.ColumnCount - 1];

        // The Paragraph that this cell houses.
        Paragraph p = cell.Paragraph;

        // Insert this rows index.
        p.InsertText(i.ToString(), false);
    }

    document.Save();
}// Release this document from memory.

See Also

Table Class
InsertColumn Overload


InsertColumn Method (Int32)

[image]

A Sandcastle Documented Class Library
Table..::.InsertColumn Method (Int32)
Table Class Example See Also Send Feedback
Insert a column into a table.

Namespace: Novacode
Assembly: DocX (in DocX.dll) Version: 1.0.0.7 (1.0.0.7)

Syntax

C#
public void InsertColumn(
    int index
)
Visual Basic (Declaration)
Public Sub InsertColumn ( _
    index As Integer _
)
Visual C++
public:
void InsertColumn(
    int index
)

Parameters

index
Type: System..::.Int32
The index to insert the column at.

Examples

Insert a column to the left of a table.
CopyC#
// Load a document.
using (DocX document = DocX.Load(@"C:\Example\Test.docx"))
{
    // Get the first Table in this document.
    Table table = document.Tables[0];

    // Insert a new column to this left of this table.
    table.InsertColumn(0);

    // Set the new coloumns text to "Row no."
    table.Rows[0].Cells[table.ColumnCount - 1].Paragraph.InsertText("Row no.", false);

    // Loop through each row in the table.
    for (int i = 1; i < table.Rows.Count; i++)
    {
        // The current row.
        Row row = table.Rows[i];

        // The cell in this row that belongs to the new coloumn.
        Cell cell = row.Cells[table.ColumnCount - 1];

        // The Paragraph that this cell houses.
        Paragraph p = cell.Paragraph;

        // Insert this rows index.
        p.InsertText(i.ToString(), false);
    }

    document.Save();
}// Release this document from memory.

See Also

Table Class
InsertColumn Overload


InsertPageBreakAfterSelf Method

[image]

A Sandcastle Documented Class Library
Table..::.InsertPageBreakAfterSelf Method
Table Class Example See Also Send Feedback
Insert a page break after a Table.

Namespace: Novacode
Assembly: DocX (in DocX.dll) Version: 1.0.0.7 (1.0.0.7)

Syntax

C#
public void InsertPageBreakAfterSelf()
Visual Basic (Declaration)
Public Sub InsertPageBreakAfterSelf
Visual C++
public:
void InsertPageBreakAfterSelf()

Examples

Insert a Table and a Paragraph into a document with a page break between them.
CopyC#
// Create a new document.
using (DocX document = DocX.Create(@"Test.docx"))
{
    // Insert a new Table.
    Table t1 = document.InsertTable(2, 2);
    t1.Design = TableDesign.LightShadingAccent1;

    // Insert a page break after this Table.
    t1.InsertPageBreakAfterSelf();

    // Insert a new Paragraph.
    Paragraph p1 = document.InsertParagraph("Paragraph", false);

    // Save this document.
    document.Save();
}// Release this document from memory.

See Also

Table Class


InsertPageBreakBeforeSelf Method

[image]

A Sandcastle Documented Class Library
Table..::.InsertPageBreakBeforeSelf Method
Table Class Example See Also Send Feedback
Insert a page break before a Table.

Namespace: Novacode
Assembly: DocX (in DocX.dll) Version: 1.0.0.7 (1.0.0.7)

Syntax

C#
public void InsertPageBreakBeforeSelf()
Visual Basic (Declaration)
Public Sub InsertPageBreakBeforeSelf
Visual C++
public:
void InsertPageBreakBeforeSelf()

Examples

Insert a Table and a Paragraph into a document with a page break between them.
CopyC#
// Create a new document.
using (DocX document = DocX.Create(@"Test.docx"))
{
    // Insert a new Paragraph.
    Paragraph p1 = document.InsertParagraph("Paragraph", false);

    // Insert a new Table.
    Table t1 = document.InsertTable(2, 2);
    t1.Design = TableDesign.LightShadingAccent1;

    // Insert a page break before this Table.
    t1.InsertPageBreakBeforeSelf();

    // Save this document.
    document.Save();
}// Release this document from memory.

See Also

Table Class


InsertParagraphAfterSelf Method

[image] [image]

A Sandcastle Documented Class Library
Table..::.InsertParagraphAfterSelf Method
Table Class See Also Send Feedback

Overload List

Name | Description
InsertParagraphAfterSelf(Paragraph) | Insert a Paragraph after this Table, this Paragraph may have come from the same or another document.
InsertParagraphAfterSelf(String) | Insert a new Paragraph after this Table.
InsertParagraphAfterSelf(String, Boolean) | Insert a new Paragraph after this Table.
InsertParagraphAfterSelf(String, Boolean, Formatting) | Insert a new Paragraph after this Table.

See Also

Table Class
Table Members


InsertParagraphAfterSelf Method (Paragraph)

[image]

A Sandcastle Documented Class Library
Table..::.InsertParagraphAfterSelf Method (Paragraph)
Table Class Example See Also Send Feedback
Insert a Paragraph after this Table, this Paragraph may have come from the same or another document.

Namespace: Novacode
Assembly: DocX (in DocX.dll) Version: 1.0.0.7 (1.0.0.7)

Syntax

C#
public Paragraph InsertParagraphAfterSelf(
    Paragraph p
)
Visual Basic (Declaration)
Public Function InsertParagraphAfterSelf ( _
    p As Paragraph _
) As Paragraph
Visual C++
public:
Paragraph^ InsertParagraphAfterSelf(
    Paragraph^ p
)

Parameters

p
Type: Novacode..::.Paragraph
The Paragraph to insert.

Return Value

The Paragraph now associated with this document.

Examples

Take a Paragraph from document a, and insert it into document b after this Table.
CopyC#
// Place holder for a Paragraph.
Paragraph p;

// Load document a.
using (DocX documentA = DocX.Load(@"a.docx"))
{
    // Get the first paragraph from this document.
    p = documentA.Paragraphs[0];
}

// Load document b.
using (DocX documentB = DocX.Load(@"b.docx"))
{
    // Get the first Table in document b.
    Table t = documentB.Tables[0];

    // Insert the Paragraph from document a after this Table.
    Paragraph newParagraph = t.InsertParagraphAfterSelf(p);

    // Save all changes made to document b.
    documentB.Save();
}// Release this document from memory.

See Also

Table Class
InsertParagraphAfterSelf Overload


InsertParagraphAfterSelf Method (String)

[image]

A Sandcastle Documented Class Library
Table..::.InsertParagraphAfterSelf Method (String)
Table Class Example See Also Send Feedback
Insert a new Paragraph after this Table.

Namespace: Novacode
Assembly: DocX (in DocX.dll) Version: 1.0.0.7 (1.0.0.7)

Syntax

C#
public Paragraph InsertParagraphAfterSelf(
    string text
)
Visual Basic (Declaration)
Public Function InsertParagraphAfterSelf ( _
    text As String _
) As Paragraph
Visual C++
public:
Paragraph^ InsertParagraphAfterSelf(
    String^ text
)

Parameters

text
Type: System..::.String
The initial text for this new Paragraph.

Return Value

A new Paragraph inserted after this Table.

Examples

Insert a new Paragraph after the first Table in this document.
CopyC#
// Create a new document.
using (DocX document = DocX.Create(@"Test.docx"))
{
    // Insert a Table into this document.
    Table t = document.InsertTable(2, 2);

    t.InsertParagraphAfterSelf("I was inserted after the previous Table.");

    // Save all changes made to this new document.
    document.Save();
   }// Release this new document form memory.

See Also

Table Class
InsertParagraphAfterSelf Overload


InsertParagraphAfterSelf Method (String, Boolean)

[image]

A Sandcastle Documented Class Library
Table..::.InsertParagraphAfterSelf Method (String, Boolean)
Table Class Example See Also Send Feedback
Insert a new Paragraph after this Table.

Namespace: Novacode
Assembly: DocX (in DocX.dll) Version: 1.0.0.7 (1.0.0.7)

Syntax

C#
public Paragraph InsertParagraphAfterSelf(
    string text,
    bool trackChanges
)
Visual Basic (Declaration)
Public Function InsertParagraphAfterSelf ( _
    text As String, _
    trackChanges As Boolean _
) As Paragraph
Visual C++
public:
Paragraph^ InsertParagraphAfterSelf(
    String^ text,
    bool trackChanges
)

Parameters

text
Type: System..::.String
The initial text for this new Paragraph.
trackChanges
Type: System..::.Boolean
Should this insertion be tracked as a change?

Return Value

A new Paragraph inserted after this Table.

Examples

Insert a new paragraph after the first Table in this document.
CopyC#
// Create a new document.
using (DocX document = DocX.Create(@"Test.docx"))
{
    // Insert a Table into this document.
    Table t = document.InsertTable(2, 2);

    t.InsertParagraphAfterSelf("I was inserted after the previous Table.", false);

    // Save all changes made to this new document.
    document.Save();
   }// Release this new document form memory.

See Also

Table Class
InsertParagraphAfterSelf Overload


InsertParagraphAfterSelf Method (String, Boolean, Formatting)

[image]

A Sandcastle Documented Class Library
Table..::.InsertParagraphAfterSelf Method (String, Boolean, Formatting)
Table Class Example See Also Send Feedback
Insert a new Paragraph after this Table.

Namespace: Novacode
Assembly: DocX (in DocX.dll) Version: 1.0.0.7 (1.0.0.7)

Syntax

C#
public Paragraph InsertParagraphAfterSelf(
    string text,
    bool trackChanges,
    Formatting formatting
)
Visual Basic (Declaration)
Public Function InsertParagraphAfterSelf ( _
    text As String, _
    trackChanges As Boolean, _
    formatting As Formatting _
) As Paragraph
Visual C++
public:
Paragraph^ InsertParagraphAfterSelf(
    String^ text,
    bool trackChanges,
    Formatting^ formatting
)

Parameters

text
Type: System..::.String
The initial text for this new Paragraph.
trackChanges
Type: System..::.Boolean
Should this insertion be tracked as a change?
formatting
Type: Novacode..::.Formatting
The formatting to apply to this insertion.

Return Value

A new Paragraph inserted after this Table.

Examples

Insert a new paragraph after the first Table in this document.
CopyC#
// Create a new document.
using (DocX document = DocX.Create(@"Test.docx"))
{
    // Insert a Table into this document.
    Table t = document.InsertTable(2, 2);

    Formatting boldFormatting = new Formatting();
    boldFormatting.Bold = true;

    t.InsertParagraphAfterSelf("I was inserted after the previous Table.", false, boldFormatting);

    // Save all changes made to this new document.
    document.Save();
   }// Release this new document form memory.

See Also

Table Class
InsertParagraphAfterSelf Overload


InsertParagraphBeforeSelf Method

[image] [image]

A Sandcastle Documented Class Library
Table..::.InsertParagraphBeforeSelf Method
Table Class See Also Send Feedback

Overload List

Name | Description
InsertParagraphBeforeSelf(Paragraph) | Insert a Paragraph before this Table, this Paragraph may have come from the same or another document.
InsertParagraphBeforeSelf(String) | Insert a new Paragraph before this Table.
InsertParagraphBeforeSelf(String, Boolean) | Insert a new Paragraph before this Table.
InsertParagraphBeforeSelf(String, Boolean, Formatting) | Insert a new Paragraph before this Table.

See Also

Table Class
Table Members


InsertParagraphBeforeSelf Method (Paragraph)

[image]

A Sandcastle Documented Class Library
Table..::.InsertParagraphBeforeSelf Method (Paragraph)
Table Class Example See Also Send Feedback
Insert a Paragraph before this Table, this Paragraph may have come from the same or another document.

Namespace: Novacode
Assembly: DocX (in DocX.dll) Version: 1.0.0.7 (1.0.0.7)

Syntax

C#
public Paragraph InsertParagraphBeforeSelf(
    Paragraph p
)
Visual Basic (Declaration)
Public Function InsertParagraphBeforeSelf ( _
    p As Paragraph _
) As Paragraph
Visual C++
public:
Paragraph^ InsertParagraphBeforeSelf(
    Paragraph^ p
)

Parameters

p
Type: Novacode..::.Paragraph
The Paragraph to insert.

Return Value

The Paragraph now associated with this document.

Examples

Take a Paragraph from document a, and insert it into document b before this Table.
CopyC#
// Place holder for a Paragraph.
Paragraph p;

// Load document a.
using (DocX documentA = DocX.Load(@"a.docx"))
{
    // Get the first paragraph from this document.
    p = documentA.Paragraphs[0];
}

// Load document b.
using (DocX documentB = DocX.Load(@"b.docx"))
{
    // Get the first Table in document b.
    Table t = documentB.Tables[0];

    // Insert the Paragraph from document a before this Table.
    Paragraph newParagraph = t.InsertParagraphBeforeSelf(p);

    // Save all changes made to document b.
    documentB.Save();
}// Release this document from memory.

See Also

Table Class
InsertParagraphBeforeSelf Overload


InsertParagraphBeforeSelf Method (String)

[image]

A Sandcastle Documented Class Library
Table..::.InsertParagraphBeforeSelf Method (String)
Table Class Example See Also Send Feedback
Insert a new Paragraph before this Table.

Namespace: Novacode
Assembly: DocX (in DocX.dll) Version: 1.0.0.7 (1.0.0.7)

Syntax

C#
public Paragraph InsertParagraphBeforeSelf(
    string text
)
Visual Basic (Declaration)
Public Function InsertParagraphBeforeSelf ( _
    text As String _
) As Paragraph
Visual C++
public:
Paragraph^ InsertParagraphBeforeSelf(
    String^ text
)

Parameters

text
Type: System..::.String
The initial text for this new Paragraph.

Return Value

A new Paragraph inserted before this Table.

Examples

Insert a new Paragraph before the first Table in this document.
CopyC#
// Create a new document.
using (DocX document = DocX.Create(@"Test.docx"))
{
    // Insert a Table into this document.
    Table t = document.InsertTable(2, 2);

    t.InsertParagraphBeforeSelf("I was inserted before the next Table.");

    // Save all changes made to this new document.
    document.Save();
   }// Release this new document form memory.

See Also

Table Class
InsertParagraphBeforeSelf Overload


InsertParagraphBeforeSelf Method (String, Boolean)

[image]

A Sandcastle Documented Class Library
Table..::.InsertParagraphBeforeSelf Method (String, Boolean)
Table Class Example See Also Send Feedback
Insert a new Paragraph before this Table.

Namespace: Novacode
Assembly: DocX (in DocX.dll) Version: 1.0.0.7 (1.0.0.7)

Syntax

C#
public Paragraph InsertParagraphBeforeSelf(
    string text,
    bool trackChanges
)
Visual Basic (Declaration)
Public Function InsertParagraphBeforeSelf ( _
    text As String, _
    trackChanges As Boolean _
) As Paragraph
Visual C++
public:
Paragraph^ InsertParagraphBeforeSelf(
    String^ text,
    bool trackChanges
)

Parameters

text
Type: System..::.String
The initial text for this new Paragraph.
trackChanges
Type: System..::.Boolean
Should this insertion be tracked as a change?

Return Value

A new Paragraph inserted before this Table.

Examples

Insert a new paragraph before the first Table in this document.
CopyC#
// Create a new document.
using (DocX document = DocX.Create(@"Test.docx"))
{
    // Insert a Table into this document.
    Table t = document.InsertTable(2, 2);

    t.InsertParagraphBeforeSelf("I was inserted before the next Table.", false);

    // Save all changes made to this new document.
    document.Save();
   }// Release this new document form memory.

See Also

Table Class
InsertParagraphBeforeSelf Overload


InsertParagraphBeforeSelf Method (String, Boolean, Formatting)

[image]

A Sandcastle Documented Class Library
Table..::.InsertParagraphBeforeSelf Method (String, Boolean, Formatting)
Table Class Example See Also Send Feedback
Insert a new Paragraph before this Table.

Namespace: Novacode
Assembly: DocX (in DocX.dll) Version: 1.0.0.7 (1.0.0.7)

Syntax

C#
public Paragraph InsertParagraphBeforeSelf(
    string text,
    bool trackChanges,
    Formatting formatting
)
Visual Basic (Declaration)
Public Function InsertParagraphBeforeSelf ( _
    text As String, _
    trackChanges As Boolean, _
    formatting As Formatting _
) As Paragraph
Visual C++
public:
Paragraph^ InsertParagraphBeforeSelf(
    String^ text,
    bool trackChanges,
    Formatting^ formatting
)

Parameters

text
Type: System..::.String
The initial text for this new Paragraph.
trackChanges
Type: System..::.Boolean
Should this insertion be tracked as a change?
formatting
Type: Novacode..::.Formatting
The formatting to apply to this insertion.

Return Value

A new Paragraph inserted before this Table.

Examples

Insert a new paragraph before the first Table in this document.
CopyC#
// Create a new document.
using (DocX document = DocX.Create(@"Test.docx"))
{
    // Insert a Table into this document.
    Table t = document.InsertTable(2, 2);

    Formatting boldFormatting = new Formatting();
    boldFormatting.Bold = true;

    t.InsertParagraphBeforeSelf("I was inserted before the next Table.", false, boldFormatting);

    // Save all changes made to this new document.
    document.Save();
   }// Release this new document form memory.

See Also

Table Class
InsertParagraphBeforeSelf Overload


InsertRow Method

[image] [image]

A Sandcastle Documented Class Library
Table..::.InsertRow Method
Table Class See Also Send Feedback

Overload List

Name | Description
InsertRow()()() | Insert a row at the end of this table.
InsertRow(Int32) | Insert a row into this table.

See Also

Table Class
Table Members


InsertRow Method

[image]

A Sandcastle Documented Class Library
Table..::.InsertRow Method
Table Class Example See Also Send Feedback
Insert a row at the end of this table.

Namespace: Novacode
Assembly: DocX (in DocX.dll) Version: 1.0.0.7 (1.0.0.7)

Syntax

C#
public Row InsertRow()
Visual Basic (Declaration)
Public Function InsertRow As Row
Visual C++
public:
Row^ InsertRow()

Return Value

A new row.

Examples

CopyC#
// Load a document.
using (DocX document = DocX.Load(@"C:\Example\Test.docx"))
{
    // Get the first table in this document.
    Table table = document.Tables[0];

    // Insert a new row at the end of this table.
    Row row = table.InsertRow();

    // Loop through each cell in this new row.
    foreach (Cell c in row.Cells)
    {
        // Set the text of each new cell to "Hello".
        c.Paragraph.InsertText("Hello", false);
    }

    // Save the document to a new file.
    document.SaveAs(@"C:\Example\Test2.docx");
}// Release this document from memory.

See Also

Table Class
InsertRow Overload


InsertRow Method (Int32)

[image]

A Sandcastle Documented Class Library
Table..::.InsertRow Method (Int32)
Table Class Example See Also Send Feedback
Insert a row into this table.

Namespace: Novacode
Assembly: DocX (in DocX.dll) Version: 1.0.0.7 (1.0.0.7)

Syntax

C#
public Row InsertRow(
    int index
)
Visual Basic (Declaration)
Public Function InsertRow ( _
    index As Integer _
) As Row
Visual C++
public:
Row^ InsertRow(
    int index
)

Parameters

index
Type: System..::.Int32
Index to insert row at.

Return Value

A new Row

Examples

CopyC#
// Load a document.
using (DocX document = DocX.Load(@"C:\Example\Test.docx"))
{
    // Get the first table in this document.
    Table table = document.Tables[0];

    // Insert a new row at index 1 in this table.
    Row row = table.InsertRow(1);

    // Loop through each cell in this new row.
    foreach (Cell c in row.Cells)
    {
        // Set the text of each new cell to "Hello".
        c.Paragraph.InsertText("Hello", false);
    }

    // Save the document to a new file.
    document.SaveAs(@"C:\Example\Test2.docx");
}// Release this document from memory.

See Also

Table Class
InsertRow Overload


InsertTableAfterSelf Method

[image] [image]

A Sandcastle Documented Class Library
Table..::.InsertTableAfterSelf Method
Table Class See Also Send Feedback

Overload List

Name | Description
InsertTableAfterSelf(Table) | Insert a new Table after this Table, this Table can be from this document or another document.
InsertTableAfterSelf(Int32, Int32) | Insert a new Table into this document after this Table.

See Also

Table Class
Table Members


InsertTableAfterSelf Method (Table)

[image]

A Sandcastle Documented Class Library
Table..::.InsertTableAfterSelf Method (Table)
Table Class Example See Also Send Feedback
Insert a new Table after this Table, this Table can be from this document or another document.

Namespace: Novacode
Assembly: DocX (in DocX.dll) Version: 1.0.0.7 (1.0.0.7)

Syntax

C#
public Table InsertTableAfterSelf(
    Table t
)
Visual Basic (Declaration)
Public Function InsertTableAfterSelf ( _
    t As Table _
) As Table
Visual C++
public:
Table^ InsertTableAfterSelf(
    Table^ t
)

Parameters

t
Type: Novacode..::.Table
The Table t to be inserted

Return Value

A new Table inserted after this Table.

Examples

Insert a new Table after this Table.
CopyC#
// Place holder for a Table.
Table t;

// Load document a.
using (DocX documentA = DocX.Load(@"a.docx"))
{
    // Get the first Table from this document.
    t = documentA.Tables[0];
}

// Load document b.
using (DocX documentB = DocX.Load(@"b.docx"))
{
    // Get the first Table in document b.
    Table t2 = documentB.Tables[0];

    // Insert the Table from document a after this Table.
    Table newTable = t2.InsertTableAfterSelf(t);

    // Save all changes made to document b.
    documentB.Save();
}// Release this document from memory.

See Also

Table Class
InsertTableAfterSelf Overload


InsertTableAfterSelf Method (Int32, Int32)

[image]

A Sandcastle Documented Class Library
Table..::.InsertTableAfterSelf Method (Int32, Int32)
Table Class Example See Also Send Feedback
Insert a new Table into this document after this Table.

Namespace: Novacode
Assembly: DocX (in DocX.dll) Version: 1.0.0.7 (1.0.0.7)

Syntax

C#
public Table InsertTableAfterSelf(
    int rowCount,
    int coloumnCount
)
Visual Basic (Declaration)
Public Function InsertTableAfterSelf ( _
    rowCount As Integer, _
    coloumnCount As Integer _
) As Table
Visual C++
public:
Table^ InsertTableAfterSelf(
    int rowCount,
    int coloumnCount
)

Parameters

rowCount
Type: System..::.Int32
The number of rows this Table should have.
coloumnCount
Type: System..::.Int32
The number of coloumns this Table should have.

Return Value

A new Table inserted before this Table.

Examples

CopyC#
// Create a new document.
using (DocX document = DocX.Create(@"Test.docx"))
{
    //Insert a Table into this document.
    Table t = document.InsertTable(2, 2);
    t.Design = TableDesign.LightShadingAccent1;
    t.Alignment = Alignment.center;

    // Insert a new Table after this Table.
    Table newTable = t.InsertTableAfterSelf(2, 2);
    newTable.Design = TableDesign.LightShadingAccent2;
    newTable.Alignment = Alignment.center;

    // Save all changes made to this document.
    document.Save();
}// Release this document from memory.

See Also

Table Class
InsertTableAfterSelf Overload


InsertTableBeforeSelf Method

[image] [image]

A Sandcastle Documented Class Library
Table..::.InsertTableBeforeSelf Method
Table Class See Also Send Feedback

Overload List

Name | Description
InsertTableBeforeSelf(Table) | Insert a new Table before this Table, this Table can be from this document or another document.
InsertTableBeforeSelf(Int32, Int32) | Insert a new Table into this document before this Table.

See Also

Table Class
Table Members


InsertTableBeforeSelf Method (Table)

[image]

A Sandcastle Documented Class Library
Table..::.InsertTableBeforeSelf Method (Table)
Table Class Example See Also Send Feedback
Insert a new Table before this Table, this Table can be from this document or another document.

Namespace: Novacode
Assembly: DocX (in DocX.dll) Version: 1.0.0.7 (1.0.0.7)

Syntax

C#
public Table InsertTableBeforeSelf(
    Table t
)
Visual Basic (Declaration)
Public Function InsertTableBeforeSelf ( _
    t As Table _
) As Table
Visual C++
public:
Table^ InsertTableBeforeSelf(
    Table^ t
)

Parameters

t
Type: Novacode..::.Table
The Table t to be inserted

Return Value

A new Table inserted before this Table.

Examples

Insert a new Table before this Table.
CopyC#
// Place holder for a Table.
Table t;

// Load document a.
using (DocX documentA = DocX.Load(@"a.docx"))
{
    // Get the first Table from this document.
    t = documentA.Tables[0];
}

// Load document b.
using (DocX documentB = DocX.Load(@"b.docx"))
{
    // Get the first Table in document b.
    Table t2 = documentB.Tables[0];

    // Insert the Table from document a before this Table.
    Table newTable = t2.InsertTableBeforeSelf(t);

    // Save all changes made to document b.
    documentB.Save();
}// Release this document from memory.

See Also

Table Class
InsertTableBeforeSelf Overload


InsertTableBeforeSelf Method (Int32, Int32)

[image]

A Sandcastle Documented Class Library
Table..::.InsertTableBeforeSelf Method (Int32, Int32)
Table Class Example See Also Send Feedback
Insert a new Table into this document before this Table.

Namespace: Novacode
Assembly: DocX (in DocX.dll) Version: 1.0.0.7 (1.0.0.7)

Syntax

C#
public Table InsertTableBeforeSelf(
    int rowCount,
    int coloumnCount
)
Visual Basic (Declaration)
Public Function InsertTableBeforeSelf ( _
    rowCount As Integer, _
    coloumnCount As Integer _
) As Table
Visual C++
public:
Table^ InsertTableBeforeSelf(
    int rowCount,
    int coloumnCount
)

Parameters

rowCount
Type: System..::.Int32
The number of rows this Table should have.
coloumnCount
Type: System..::.Int32
The number of coloumns this Table should have.

Return Value

A new Table inserted before this Table.

Examples

CopyC#
// Create a new document.
using (DocX document = DocX.Create(@"Test.docx"))
{
    //Insert a Table into this document.
    Table t = document.InsertTable(2, 2);
    t.Design = TableDesign.LightShadingAccent1;
    t.Alignment = Alignment.center;

    // Insert a new Table before this Table.
    Table newTable = t.InsertTableBeforeSelf(2, 2);
    newTable.Design = TableDesign.LightShadingAccent2;
    newTable.Alignment = Alignment.center;

    // Save all changes made to this document.
    document.Save();
}// Release this document from memory.

See Also

Table Class
InsertTableBeforeSelf Overload


Remove Method

[image]

A Sandcastle Documented Class Library
Table..::.Remove Method
Table Class Example See Also Send Feedback
Remove this Table from this document.

Namespace: Novacode
Assembly: DocX (in DocX.dll) Version: 1.0.0.7 (1.0.0.7)

Syntax

C#
public void Remove()
Visual Basic (Declaration)
Public Sub Remove
Visual C++
public:
void Remove()

Examples

Remove the first Table from this document.
CopyC#
// Load a document into memory.
using (DocX document = DocX.Load(@"Test.docx"))
{
    // Get the first Table in this document.
    Table t = d.Tables[0];

    // Remove this Table.
    t.Remove();

    // Save all changes made to the document.
    document.Save();
} // Release this document from memory.

See Also

Table Class


RemoveColumn Method

[image] [image]

A Sandcastle Documented Class Library
Table..::.RemoveColumn Method
Table Class See Also Send Feedback

Overload List

Name | Description
RemoveColumn()()() | Remove the last column for this Table.
RemoveColumn(Int32) | Remove a coloumn from this Table.

See Also

Table Class
Table Members


RemoveColumn Method

[image]

A Sandcastle Documented Class Library
Table..::.RemoveColumn Method
Table Class Example See Also Send Feedback
Remove the last column for this Table.

Namespace: Novacode
Assembly: DocX (in DocX.dll) Version: 1.0.0.7 (1.0.0.7)

Syntax

C#
public void RemoveColumn()
Visual Basic (Declaration)
Public Sub RemoveColumn
Visual C++
public:
void RemoveColumn()

Examples

Remove the last column from a Table.
CopyC#
// Load a document.
using (DocX document = DocX.Load(@"C:\Example\Test.docx"))
{
    // Get the first table in this document.
    Table table = document.Tables[0];

    // Remove the last column from this table.
    table.RemoveColumn();

    // Save the document.
    document.Save();
}// Release this document from memory.

See Also

Table Class
RemoveColumn Overload


RemoveColumn Method (Int32)

[image]

A Sandcastle Documented Class Library
Table..::.RemoveColumn Method (Int32)
Table Class Example See Also Send Feedback
Remove a coloumn from this Table.

Namespace: Novacode
Assembly: DocX (in DocX.dll) Version: 1.0.0.7 (1.0.0.7)

Syntax

C#
public void RemoveColumn(
    int index
)
Visual Basic (Declaration)
Public Sub RemoveColumn ( _
    index As Integer _
)
Visual C++
public:
void RemoveColumn(
    int index
)

Parameters

index
Type: System..::.Int32
The coloumn to remove.

Examples

Remove the first column from a Table.
CopyC#
// Load a document.
using (DocX document = DocX.Load(@"C:\Example\Test.docx"))
{
    // Get the first table in this document.
    Table table = document.Tables[0];

    // Remove the first column from this table.
    table.RemoveColumn(0);

    // Save the document.
    document.Save();
}// Release this document from memory.

See Also

Table Class
RemoveColumn Overload


RemoveRow Method

[image] [image]

A Sandcastle Documented Class Library
Table..::.RemoveRow Method
Table Class See Also Send Feedback

Overload List

Name | Description
RemoveRow()()() | Remove the last row from this Table.
RemoveRow(Int32) | Remove a row from this Table.

See Also

Table Class
Table Members


RemoveRow Method

[image]

A Sandcastle Documented Class Library
Table..::.RemoveRow Method
Table Class Example See Also Send Feedback
Remove the last row from this Table.

Namespace: Novacode
Assembly: DocX (in DocX.dll) Version: 1.0.0.7 (1.0.0.7)

Syntax

C#
public void RemoveRow()
Visual Basic (Declaration)
Public Sub RemoveRow
Visual C++
public:
void RemoveRow()

Examples

Remove the last row from a Table.
CopyC#
// Load a document.
using (DocX document = DocX.Load(@"C:\Example\Test.docx"))
{
    // Get the first table in this document.
    Table table = document.Tables[0];

    // Remove the last row from this table.
    table.RemoveRow();

    // Save the document.
    document.Save();
}// Release this document from memory.

See Also

Table Class
RemoveRow Overload


RemoveRow Method (Int32)

[image]

A Sandcastle Documented Class Library
Table..::.RemoveRow Method (Int32)
Table Class Example See Also Send Feedback
Remove a row from this Table.

Namespace: Novacode
Assembly: DocX (in DocX.dll) Version: 1.0.0.7 (1.0.0.7)

Syntax

C#
public void RemoveRow(
    int index
)
Visual Basic (Declaration)
Public Sub RemoveRow ( _
    index As Integer _
)
Visual C++
public:
void RemoveRow(
    int index
)

Parameters

index
Type: System..::.Int32
The row to remove.

Examples

Remove the first row from a Table.
CopyC#
// Load a document.
using (DocX document = DocX.Load(@"C:\Example\Test.docx"))
{
    // Get the first table in this document.
    Table table = document.Tables[0];

    // Remove the first row from this table.
    table.RemoveRow(0);

    // Save the document.
    document.Save();
}// Release this document from memory.

See Also

Table Class
RemoveRow Overload


Table Properties

[image] [image]

A Sandcastle Documented Class Library
Table Properties
Table Class See Also Send Feedback

The Table type exposes the following members.

Properties

Name | Description
Alignment |
AutoFit | Auto size this table according to some rule.
ColumnCount | Returns the number of coloumns in this table.
Design | The design\style to apply to this table.
Index | Returns the index of this Table.
RowCount | Returns the number of rows in this table.
Rows | Returns a list of rows in this table.

See Also

Table Class


Alignment Property

[image]

A Sandcastle Documented Class Library
Table..::.Alignment Property
Table Class See Also Send Feedback

[Missing <summary> documentation for "P:Novacode.Table.Alignment"]

Namespace: Novacode
Assembly: DocX (in DocX.dll) Version: 1.0.0.7 (1.0.0.7)

Syntax

C#
public Alignment Alignment { get; set; }
Visual Basic (Declaration)
Public Property Alignment As Alignment
Visual C++
public:
property Alignment Alignment {
    Alignment get ();
    void set (Alignment value);
}

See Also

Table Class


AutoFit Property

[image]

A Sandcastle Documented Class Library
Table..::.AutoFit Property
Table Class See Also Send Feedback
Auto size this table according to some rule.

Namespace: Novacode
Assembly: DocX (in DocX.dll) Version: 1.0.0.7 (1.0.0.7)

Syntax

C#
public AutoFit AutoFit { get; set; }
Visual Basic (Declaration)
Public Property AutoFit As AutoFit
Visual C++
public:
property AutoFit AutoFit {
    AutoFit get ();
    void set (AutoFit value);
}

See Also

Table Class


ColumnCount Property

[image]

A Sandcastle Documented Class Library
Table..::.ColumnCount Property
Table Class See Also Send Feedback
Returns the number of coloumns in this table.

Namespace: Novacode
Assembly: DocX (in DocX.dll) Version: 1.0.0.7 (1.0.0.7)

Syntax

C#
public int ColumnCount { get; }
Visual Basic (Declaration)
Public ReadOnly Property ColumnCount As Integer
Visual C++
public:
property int ColumnCount {
    int get ();
}

See Also

Table Class


Design Property

[image]

A Sandcastle Documented Class Library
Table..::.Design Property
Table Class See Also Send Feedback
The design\style to apply to this table.

Namespace: Novacode
Assembly: DocX (in DocX.dll) Version: 1.0.0.7 (1.0.0.7)

Syntax

C#
public TableDesign Design { get; set; }
Visual Basic (Declaration)
Public Property Design As TableDesign
Visual C++
public:
property TableDesign Design {
    TableDesign get ();
    void set (TableDesign value);
}

See Also

Table Class


Index Property

[image]

A Sandcastle Documented Class Library
Table..::.Index Property
Table Class Example See Also Send Feedback
Returns the index of this Table.

Namespace: Novacode
Assembly: DocX (in DocX.dll) Version: 1.0.0.7 (1.0.0.7)

Syntax

C#
public int Index { get; }
Visual Basic (Declaration)
Public ReadOnly Property Index As Integer
Visual C++
public:
property int Index {
    int get ();
}

Examples

Replace the first table in this document with a new Table.
CopyC#
// Load a document into memory.
using (DocX document = DocX.Load(@"Test.docx"))
{
    // Get the first Table in this document.
    Table t = document.Tables[0];

    // Get the character index of Table t in this document.
    int index = t.Index;

    // Remove Table t.
    t.Remove();

    // Insert a new Table at the original index of Table t.
    Table newTable = document.InsertTable(index, 4, 4);

    // Set the design of this new Table, so that we can see it.
    newTable.Design = TableDesign.LightShadingAccent1;

    // Save all changes made to the document.
    document.Save();
} // Release this document from memory.

See Also

Table Class


RowCount Property

[image]

A Sandcastle Documented Class Library
Table..::.RowCount Property
Table Class See Also Send Feedback
Returns the number of rows in this table.

Namespace: Novacode
Assembly: DocX (in DocX.dll) Version: 1.0.0.7 (1.0.0.7)

Syntax

C#
public int RowCount { get; }
Visual Basic (Declaration)
Public ReadOnly Property RowCount As Integer
Visual C++
public:
property int RowCount {
    int get ();
}

See Also

Table Class


Rows Property

[image]

A Sandcastle Documented Class Library
Table..::.Rows Property
Table Class See Also Send Feedback
Returns a list of rows in this table.

Namespace: Novacode
Assembly: DocX (in DocX.dll) Version: 1.0.0.7 (1.0.0.7)

Syntax

C#
public List<Row> Rows { get; }
Visual Basic (Declaration)
Public ReadOnly Property Rows As List(Of Row)
Visual C++
public:
property List<Row^>^ Rows {
    List<Row^>^ get ();
}

See Also

Table Class


TableDesign Enumeration

[image]

A Sandcastle Documented Class Library
TableDesign Enumeration
See Also Send Feedback
Designs\Styles that can be applied to a table.

Namespace: Novacode
Assembly: DocX (in DocX.dll) Version: 1.0.0.7 (1.0.0.7)

Syntax

C#
public enum TableDesign
Visual Basic (Declaration)
Public Enumeration TableDesign
Visual C++
public enum class TableDesign

Members

Member name | Description
Custom |
TableNormal |
TableGrid |
LightShading |
LightShadingAccent1 |
LightShadingAccent2 |
LightShadingAccent3 |
LightShadingAccent4 |
LightShadingAccent5 |
LightShadingAccent6 |
LightList |
LightListAccent1 |
LightListAccent2 |
LightListAccent3 |
LightListAccent4 |
LightListAccent5 |
LightListAccent6 |
LightGrid |
LightGridAccent1 |
LightGridAccent2 |
LightGridAccent3 |
LightGridAccent4 |
LightGridAccent5 |
LightGridAccent6 |
MediumShading1 |
MediumShading1Accent1 |
MediumShading1Accent2 |
MediumShading1Accent3 |
MediumShading1Accent4 |
MediumShading1Accent5 |
MediumShading1Accent6 |
MediumShading2 |
MediumShading2Accent1 |
MediumShading2Accent2 |
MediumShading2Accent3 |
MediumShading2Accent4 |
MediumShading2Accent5 |
MediumShading2Accent6 |
MediumList1 |
MediumList1Accent1 |
MediumList1Accent2 |
MediumList1Accent3 |
MediumList1Accent4 |
MediumList1Accent5 |
MediumList1Accent6 |
MediumList2 |
MediumList2Accent1 |
MediumList2Accent2 |
MediumList2Accent3 |
MediumList2Accent4 |
MediumList2Accent5 |
MediumList2Accent6 |
MediumGrid1 |
MediumGrid1Accent1 |
MediumGrid1Accent2 |
MediumGrid1Accent3 |
MediumGrid1Accent4 |
MediumGrid1Accent5 |
MediumGrid1Accent6 |
MediumGrid2 |
MediumGrid2Accent1 |
MediumGrid2Accent2 |
MediumGrid2Accent3 |
MediumGrid2Accent4 |
MediumGrid2Accent5 |
MediumGrid2Accent6 |
MediumGrid3 |
MediumGrid3Accent1 |
MediumGrid3Accent2 |
MediumGrid3Accent3 |
MediumGrid3Accent4 |
MediumGrid3Accent5 |
MediumGrid3Accent6 |
DarkList |
DarkListAccent1 |
DarkListAccent2 |
DarkListAccent3 |
DarkListAccent4 |
DarkListAccent5 |
DarkListAccent6 |
ColorfulShading |
ColorfulShadingAccent1 |
ColorfulShadingAccent2 |
ColorfulShadingAccent3 |
ColorfulShadingAccent4 |
ColorfulShadingAccent5 |
ColorfulShadingAccent6 |
ColorfulList |
ColorfulListAccent1 |
ColorfulListAccent2 |
ColorfulListAccent3 |
ColorfulListAccent4 |
ColorfulListAccent5 |
ColorfulListAccent6 |
ColorfulGrid |
ColorfulGridAccent1 |
ColorfulGridAccent2 |
ColorfulGridAccent3 |
ColorfulGridAccent4 |
ColorfulGridAccent5 |
ColorfulGridAccent6 |
None |

See Also

Novacode Namespace


UnderlineStyle Enumeration

[image]

A Sandcastle Documented Class Library
UnderlineStyle Enumeration
See Also Send Feedback

[Missing <summary> documentation for "T:Novacode.UnderlineStyle"]

Namespace: Novacode
Assembly: DocX (in DocX.dll) Version: 1.0.0.7 (1.0.0.7)

Syntax

C#
public enum UnderlineStyle
Visual Basic (Declaration)
Public Enumeration UnderlineStyle
Visual C++
public enum class UnderlineStyle

Members

Member name | Description
none |
singleLine |
doubleLine |
thick |
dotted |
dottedHeavy |
dash |
dashedHeavy |
dashLong |
dashLongHeavy |
dotDash |
dashDotHeavy |
dotDotDash |
dashDotDotHeavy |
wave |
wavyHeavy |
wavyDouble |
words |

See Also

Novacode Namespace