Word Reports
InsertPageBreaks Property
Example 



KellermanSoftware.WordReports Namespace > Configuration Class : InsertPageBreaks Property
Insert page breaks when performing a search and replace of lists of items. The default is true.
Syntax
Public Property InsertPageBreaks As Boolean
Dim instance As Configuration
Dim value As Boolean
 
instance.InsertPageBreaks = value
 
value = instance.InsertPageBreaks
public bool InsertPageBreaks {get; set;}
public:
property bool InsertPageBreaks {
   bool get();
   void set (    bool value);
}
Example
//To run this example code, create a word document called ExampleTemplate.docx with the text [ReplaceMe] in the document
 
WordReportsGenerator generator = new WordReportsGenerator(); //Trial Mode
//WordReportsGenerator generator = new WordReportsGenerator("place user name here", "place license key here"); //License Mode
 
const string sourceDocumentPath = @"Test Documents\ExampleTemplate.docx";
const string outputDocumentPath = "ExampleOutput.docx";
 
using (Document document = generator.DocumentFactory(sourceDocumentPath))
{
    Dictionary<string, ReplacementItem> replacement1 =
        new Dictionary<string, ReplacementItem>
        {
            {
                "[ReplaceMe]",
                new ReplacementItem { Value = "Text1" }
            }
        };
    Dictionary<string, ReplacementItem> replacement2 =
        new Dictionary<string, ReplacementItem>
        {
            {
                "[ReplaceMe]",
                new ReplacementItem { Value = "Text2" }
            }
        };
    List<Dictionary<string, ReplacementItem>> replacementList =
        new List<Dictionary<string, ReplacementItem>>
        {
            replacement1,
            replacement2
        };
 
    generator.Config.InsertPageBreaks = false;
 
    generator.Replace(document, replacementList);
 
    generator.SaveDocument(document, outputDocumentPath);
}
'To run this example code, create a word document called ExampleTemplate.docx with the text [ReplaceMe] in the document
 
Dim generator As New WordReportsGenerator() 'Trial Mode
'WordReportsGenerator generator = new WordReportsGenerator("place user name here", "place license key here"); //License Mode
 
Const sourceDocumentPath As String = "Test Documents\ExampleTemplate.docx"
Const outputDocumentPath As String = "ExampleOutput.docx"
 
Using document As Document = generator.DocumentFactory(sourceDocumentPath)
    Dim replacement1 As New Dictionary(Of String, ReplacementItem)() From {{ "[ReplaceMe]", New ReplacementItem With {.Value = "Text1"} }}
    Dim replacement2 As New Dictionary(Of String, ReplacementItem)() From {{ "[ReplaceMe]", New ReplacementItem With {.Value = "Text2"} }}
    Dim replacementList As New List(Of Dictionary(Of String, ReplacementItem))() From {replacement1, replacement2}
 
    generator.Config.InsertPageBreaks = False
 
    generator.Replace(document, replacementList)
 
    generator.SaveDocument(document, outputDocumentPath)
End Using
Requirements

Target Platforms: Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2

See Also

Reference

Configuration Class
Configuration Members