I use Aspose.Word. When you try to resize the page, everything changes. BUT the images go beyond the boundaries of the text space. There are several images in the document and I have no idea how to fix it. `
var input = @"d:\1.docx";
var output = @"d:\2.docx";
Document doc = new Document(input);
DocumentBuilder builder = new DocumentBuilder(doc);
if (project.Variables["flagsize"].Value=="69")
{
builder.PageSetup.PageWidth = ConvertUtil.MillimeterToPoint(152.4);
builder.PageSetup.PageHeight = ConvertUtil.MillimeterToPoint(228.6);
Node[] runs = doc.GetChildNodes(NodeType.Run, true).ToArray();
for (int j = 0; j < runs.Length; j++)
{ Run run = (Run)runs[j];
run.Font.Size = 18;
}
}
foreach (Section section in doc)
{
section.PageSetup.PaperSize = Aspose.Words.PaperSize.Custom;
section.PageSetup.LeftMargin= ConvertUtil.MillimeterToPoint(22);
section.PageSetup.RightMargin= ConvertUtil.MillimeterToPoint(22);
}
doc.Save(output);
`
Try to find correct method of word. Expecting all images at doc will be right dimensions
I think this code i need:
foreach (Aspose.Words.Drawing.Shape shape in doc)
{
shape.Width ...
}
But i have error : Не удалось привести тип объекта "Aspose.Words.Section" к типу "Aspose.Words.Drawing.Shape".