Hi there,
We are using Aspose .NET API to replace a logo in word documents. It works for some, but it fails on others. Here is the code we are using.
Please find attached a document, for which the logo replacement does not work. Can you please suggest what needs to be changed for the code?.
Thanks,
Ratnakar
Document wordDocument = new Document(originalFileName);
HeaderFooterCollection headers = wordDocument.FirstSection.HeadersFooters;
Boolean logoFound = false;
foreach (HeaderFooter header in headers)
{
if (header.HeaderFooterType == HeaderFooterType.HeaderFirst
|| header.HeaderFooterType == HeaderFooterType.HeaderPrimary || header.HeaderFooterType ==
HeaderFooterType.HeaderEven)
{
Shape shape = (Shape)header.GetChild(NodeType.Shape, 0, true);
if (shape!=null && (shape.HasImage))
{
logoFound = true;
shape.ImageData.SetImage(headerLogo);
}
}
}
aa.doc.zip (29.3 KB)