Hi Johan,
Thanks for your inquiry.
Please don't mind that we add the answers after your problems. About the functionalities which we don't support at present, we are sorry for the inconvenience. We will add the functionalities in subsequent versions of spire.doc. Once the version has been released, we will inform you immediately.
1. Specify an external stylesheet as the .docx file seems to be missing the styles from my stylesheet (see line 31/32 in .cs file).
We are sorry that spire.doc doesn't support the functionality at present.
2. Add a pagebreak ( see comment on lines 30 and 72 in attcahed .aspx file).
We are sorry that spire.doc doesn't support the functionality at present.
3. Add a header and footer which contain text and an image.
Spire.doc supports adding a header and footer which contain text and an image to a doc/docx file. We provide you with some sample code.
- Code: Select all
static void InsertHeaderAndFooter(Section section)
{
HeaderFooter header = section.HeadersFooters.Header;
HeaderFooter footer = section.HeadersFooters.Footer;
//insert picture and text to header
Paragraph headerParagraph = header.AddParagraph();
DocPicture headerPicture= headerParagraph.AppendPicture(Image.FromFile(@"Header.png"));
//header text
TextRange text = headerParagraph.AppendText("Demo of Spire.Doc");
text.CharacterFormat.FontName = "Arial";
text.CharacterFormat.FontSize = 10;
text.CharacterFormat.Italic = true;
headerParagraph.Format.HorizontalAlignment= Spire.Doc.Documents.HorizontalAlignment.Right;
//border
headerParagraph.Format.Borders.Bottom.BorderType= Spire.Doc.Documents.BorderStyle.Single;
headerParagraph.Format.Borders.Bottom.Space = 0.05F;
//header picture layout - text wrapping
headerPicture.TextWrappingStyle = TextWrappingStyle.Behind;
//header picture layout - position
headerPicture.HorizontalOrigin = HorizontalOrigin.Page;
headerPicture.HorizontalAlignment = ShapeHorizontalAlignment.Left;
headerPicture.VerticalOrigin = VerticalOrigin.Page;
headerPicture.VerticalAlignment = ShapeVerticalAlignment.Top;
//insert picture to footer
Paragraph footerParagraph = footer.AddParagraph();
DocPicture footerPicture = footerParagraph.AppendPicture(Image.FromFile(@"Footer.png"));
//footer picture layout
footerPicture.TextWrappingStyle = TextWrappingStyle.Behind;
footerPicture.HorizontalOrigin = HorizontalOrigin.Page;
footerPicture.HorizontalAlignment = ShapeHorizontalAlignment.Left;
footerPicture.VerticalOrigin = VerticalOrigin.Page;
footerPicture.VerticalAlignment = ShapeVerticalAlignment.Bottom;
//insert page number
footerParagraph.AppendField("page number", FieldType.FieldPage);
footerParagraph.AppendText(" of ");
footerParagraph.AppendField("number of pages", FieldType.FieldNumPages);
footerParagraph.Format.HorizontalAlignment = Spire.Doc.Documents.HorizontalAlignment.Right;
//border
footerParagraph.Format.Borders.Top.BorderType = Spire.Doc.Documents.BorderStyle.Single;
footerParagraph.Format.Borders.Top.Space = 0.05F;
}
4. If an image width/height is specified, it seems to be ignored by Spire.doc .
We are sorry that spire.doc doesn't support the functionality at present.
Best regards.
Amy
E-iceblue support