版权声明:小生不才,能帮助众人皆可。 https://blog.csdn.net/qq_23126581/article/details/79173412
引用Aspose.Words.dll 对word文档进行操作
1.插入纵页或者横页
Document doc = new Document(tempFile);
DocumentBuilder builder = new DocumentBuilder(doc);
DocumentBuilder builder = new DocumentBuilder(doc);
插入分页符:
builder.InsertBreak(BreakType.SectionBreakNewPage);
builder.InsertBreak(BreakType.PageBreak);
以上都是插入分页符,这里就介绍2种。
设置纸张大小:
builder.PageSetup.PaperSize = PaperSize.A4;
插入纵页:
builder.PageSetup.Orientation = Aspose.Words.Orientation.Portrait;
插入横页:
builder.PageSetup.Orientation = Aspose.Words.Orientation.Landscape;
插入图片:
①builder.InsertImage(file, RelativeHorizontalPosition.Page, 90, RelativeVerticalPosition.Line, 0, 640, 350,WrapType.Square);
②builder.InsertImage(file); //file是图片路径,由于插入图片有12个方法,我这里就举2个了。