Thanks for sharing the document. I have modfied the code according to the shared document. Please find the output document in attachment. You can use the same code in your object model. Hope this helps you. Please let us know if you have any more queries.
Document FinalDoc = new
Document();
DocumentBuilder
builder = new DocumentBuilder(FinalDoc);
Style
Heading1 = FinalDoc.Styles[StyleIdentifier.Heading1];
Style
Heading2 = FinalDoc.Styles[StyleIdentifier.Heading2];
Heading1.Font.Name = "Cambria";
Heading1.Font.Size = 14;
Heading1.Font.Bold = true;
Heading1.Font.Color = Color.DarkBlue;
Heading2.Font.Name = "Cambria";
Heading2.Font.Size = 13;
Heading2.Font.Bold = true;
Heading2.Font.Color = Color.DarkBlue;
builder.MoveTo(FinalDoc.FirstSection.Body.FirstParagraph);
builder.MoveToParagraph(0, 0);
builder.ParagraphFormat.Alignment = ParagraphAlignment.Center;
//
=============================================
// COVER PAGE
//
=============================================
//
Read image from file to Image object
Image
img = Image.FromFile(MyDir + "Lion.png");
//Add
the image to the document and set it's position and size
Shape
shp = builder.InsertImage(img);
shp.WrapType = WrapType.Inline;
//builder.InsertBreak(BreakType.PageBreak);
Paragraph
para = builder.InsertParagraph();
para.AppendChild(new Run(FinalDoc, ""));
//
=============================================
// TITLE PAGE AND COPYRIGHT INFO
//
=============================================
//Object
2: RTF Content (Title and some Copyright
information)
//Document
docTitlePage = AsposeHelperManager.RtfStringToDocument(@_EBookMaker.TitlePage.RtfContent);//"chapter
1 title RTF STring");
String
str = @"This is the Title and Copyright Page.
This should be right after the cover image page
Copyright © 2012 by Joe Blog. All rights reserved worldwide.
part of this publication may be replicated, redistributed, or given away in any
form without the prior written consent of the author/publisher or the terms
relayed to you herein.
Joe Blog, Book Wizard Group,
1023 King Street, Toronto, M6W 2K5, Canada
www.wizardGroup.com
";
Document
docTitlePage = RtfStringToDocument(str);//"chapter
1 title RTF STring");
foreach
(Paragraph para2 in
docTitlePage.GetChildNodes(NodeType.Paragraph,
true))
{
para2.ParagraphFormat.Alignment = ParagraphAlignment.Center;
}
InsertDocument(para,
docTitlePage);
builder.MoveTo(para);
builder.InsertBreak(BreakType.PageBreak);
//
=============================================
// TOC
//
=============================================
builder.MoveToDocumentEnd();
builder.InsertBreak(BreakType.PageBreak);
builder.ParagraphFormat.ClearFormatting();
builder.Font.Color = Color.DarkBlue;
builder.Font.Name = "Cambria";
builder.Font.Size = 14;
builder.Writeln("Contents ");
builder.Font.Color = Color.Black;
builder.Font.Name = "Calibri";
builder.Font.Size = 11;
builder.InsertTableOfContents("\\o \"1-3\" \\h \\z \\u");
builder.InsertBreak(BreakType.PageBreak);
builder.Font.ClearFormatting();
builder.ParagraphFormat.StyleIdentifier = StyleIdentifier.Heading1;
builder.Writeln("Chapter 1");
shp = builder.InsertImage(img);
shp.WrapType = WrapType.Inline;
builder.Writeln("");
str = @"This
is Chapter 1 content...
Africa's lions of the Serengeti Park. This is a amazing peek
into the lives of a tribe of lions that live and hunt on the vast plains of the
Serengeti National Park.
";
builder.ParagraphFormat.ClearFormatting();
builder.Font.Name = "Arial";
builder.Font.Size = 12;
builder.Font.Color = Color.Black;
builder.Font.Bold = false;
builder.ParagraphFormat.Alignment = ParagraphAlignment.Left;
builder.Writeln(str);
builder.Font.ClearFormatting();
builder.ParagraphFormat.StyleIdentifier = StyleIdentifier.Heading2;
builder.Writeln("Introduction");
builder.Writeln("");
str = @"This
is Section 1 of Chapter 1 content...
Lions are the only cats that live in groups, which are called
prides. Prides are family units that may include up to three males, a dozen or
so females, and their young. All of a pride's lionesses are related, and female
cubs typically stay with the group as they age. Young males eventually leave
and establish their own prides by taking over a group headed by another male.
";
builder.ParagraphFormat.ClearFormatting();
builder.Font.Name = "Arial";
builder.Font.Size = 12;
builder.Font.Color = Color.Black;
builder.Font.Bold = false;
builder.ParagraphFormat.Alignment = ParagraphAlignment.Left;
builder.Writeln(str);
// Your code................
// Your code................
// Your code................
FinalDoc.UpdateFields();
FinalDoc.Save(MyDir + "AsposeOut.doc", SaveFormat.Doc);