I have a barcode creation code and the footer
BarcodeGenerator generator = new BarcodeGenerator(EncodeTypes.Code128, "1234567890");
Stream ms = new MemoryStream();
generator.Save(ms, BarCodeImageFormat.Png);
Aspose.Words.Document doc = new Aspose.Words.Document();
DocumentBuilder builder = new DocumentBuilder(doc);
builder.InsertImage(ms,
RelativeHorizontalPosition.Margin,
0,
RelativeVerticalPosition.Margin,
400,
200,
100,
WrapType.Square);
There are two questions
- How to create a right footer, now it is being created on the left
2)How to insert a barcode into the footer
Now the barcode is inserted in an arbitrary place.I use aspose.words.
>Solution :
You can use DocumentBuilder.MoveToHeaderFooter to move cursor into the footer and then use ParagraphAlignment.Right to place barcode at right. See the following code:
BarcodeGenerator generator = new BarcodeGenerator(EncodeTypes.Code128, "1234567890");
Stream ms = new MemoryStream();
generator.Save(ms, BarCodeImageFormat.Png);
Document doc = new Document();
DocumentBuilder builder = new DocumentBuilder(doc);
// Move DocumentBuilder into the footer.
builder.MoveToHeaderFooter(HeaderFooterType.FooterPrimary);
builder.ParagraphFormat.Alignment = ParagraphAlignment.Right;
builder.InsertImage(ms);
doc.Save(@"C:\Temp\out.docx");