Specifies type of break at the beginning of the section.
Namespace: SautinSoft.DocumentAssembly: SautinSoft.Document (in SautinSoft.Document.dll) Version: 2024.12.16
Syntax Public Enumeration SectionStart
Members Member name | Value | Description |
---|
NewPage | 0 |
The section starts from a new page.
|
NewColumn | 1 |
The section starts from a new column.
|
Continuous | 2 |
The new section starts on the same page as the previous section.
|
EvenPage | 3 |
The section starts on a new even page.
|
OddPage | 4 |
The section starts on a new odd page.
|
Example See Developer Guide: How to merge two documents: DOCX and PDF
How to merge two documents: DOCX and PDF using C#
using System;
using System.IO;
using SautinSoft.Document;
namespace Sample
{
class Sample
{
static void Main(string[] args)
{
MergeTwoDocuments();
}
public static void MergeTwoDocuments()
{
string singleFilePath = "Single.docx";
string[] supportedFiles = new string[] { @"..\..\..\example.docx", @"..\..\..\example.pdf" };
DocumentCore dcSingle = new DocumentCore();
foreach (string file in supportedFiles)
{
DocumentCore dc = DocumentCore.Load(file);
Console.WriteLine("Adding: {0}...", Path.GetFileName(file));
ImportSession session = new ImportSession(dc, dcSingle, StyleImportingMode.KeepSourceFormatting);
foreach (Section sourceSection in dc.Sections)
{
Section importedSection = dcSingle.Import<Section>(sourceSection, true, session);
if (dc.Sections.IndexOf(sourceSection) == 0)
importedSection.PageSetup.SectionStart = SectionStart.NewPage;
dcSingle.Sections.Add(importedSection);
}
}
dcSingle.Save(singleFilePath);
System.Diagnostics.Process.Start(new System.Diagnostics.ProcessStartInfo(singleFilePath) { UseShellExecute = true });
}
}
}
How to merge two documents: DOCX and PDF using VB.Net
Imports System
Imports System.IO
Imports SautinSoft.Document
Module Sample
Sub Main()
MergeTwoDocuments()
End Sub
Sub MergeTwoDocuments()
Dim singleFilePath As String = "Single.docx"
Dim supportedFiles() As String = {"..\..\..\example.docx", "..\..\..\example.pdf"}
Dim dcSingle As New DocumentCore()
For Each file As String In supportedFiles
Dim dc As DocumentCore = DocumentCore.Load(file)
Console.WriteLine("Adding: {0}...", Path.GetFileName(file))
Dim session As New ImportSession(dc, dcSingle, StyleImportingMode.KeepSourceFormatting)
For Each sourceSection As Section In dc.Sections
Dim importedSection As Section = dcSingle.Import(Of Section)(sourceSection, True, session)
If dc.Sections.IndexOf(sourceSection) = 0 Then
importedSection.PageSetup.SectionStart = SectionStart.NewPage
End If
dcSingle.Sections.Add(importedSection)
Next sourceSection
Next file
dcSingle.Save(singleFilePath)
System.Diagnostics.Process.Start(New System.Diagnostics.ProcessStartInfo(singleFilePath) With {.UseShellExecute = True})
End Sub
End Module
See Also