We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Image in word docuemnt header does not appear in PDF aspose.words 16.8.0

Hello,
I insert image with {INCLUDETEXT {MEGEFIELD PATHCOMPONENT} { MEGEFIELD logo}}
in my code :
mapVars.put(config.getVarPathComponent(), config.getComunComponent());

mapVars.put(config.getVarPathProject(), config.getDocPathComponent(project));

doc.getMailMerge().execute(new XmlMailMergeVar(mapVars));

i use aspose.words 16.8.0.

Result : I generate pdf and image in word document does not appear in pdf result.

Hi Amine,


Please create a standalone runnable Java application (source code without compilation errors) that helps us reproduce your problem with Aspose.Words for Java 16.10.0 on our end and attach it here for testing.

Please also attach your template Word document here for testing.

Thanks for your cooperation.

Best regards,
Hello,

I used this version Aspose.Words for Java 16.10.0 and i have this problem "Error! Not a valid filename" .{INCLUDETEXT {MEGEFIELD PATHCOMPONENT} { MEGEFIELD logo}}
Can you please put this code in header and generate a pdf?


Best regards

How to merge IncludeText placed in header and footer?

Hi Amine,


Please see attached sample input/output documents and try running the following code:
<span style=“background-color: rgb(255, 255, 255); font-family: “Courier New”; font-size: 9pt;”>
<span style=“background-color: rgb(255, 255, 255); font-family: “Courier New”; font-size: 9pt;”>Document doc = <span style=“font-family: “Courier New”; font-size: 9pt; color: rgb(0, 0, 128); font-weight: bold;”>new <span style=“background-color: rgb(255, 255, 255); font-family: “Courier New”; font-size: 9pt;”>Document(<span style=“font-family: “Courier New”; font-size: 9pt; color: rgb(0, 128, 0); font-weight: bold;”>“D:<span style=“font-family: “Courier New”; font-size: 9pt; color: rgb(0, 0, 128); font-weight: bold;”>\<span style=“font-family: “Courier New”; font-size: 9pt; color: rgb(0, 128, 0); font-weight: bold;”>temp<span style=“font-family: “Courier New”; font-size: 9pt; color: rgb(0, 0, 128); font-weight: bold;”>\<span style=“font-family: “Courier New”; font-size: 9pt; color: rgb(0, 128, 0); font-weight: bold;”>input.docx”<span style=“background-color: rgb(255, 255, 255); font-family: “Courier New”; font-size: 9pt;”>);
<pre style=“background-color: rgb(255, 255, 255); font-family: “Courier New”; font-size: 9pt;”>
doc.getMailMerge().execute(
new String[]{“PATHCOMPONENT”},
new String[]{" D:\\Temp\\abc.txt"});

doc.save(“D:\temp\16.10.0.docx”);

Best regards,

Thanks you for your response,


my problem is when i add an image as bookmark word '‘signet in word’. for exemple you put the image in abc.txt and in input.docx you put this code in the header {INCLUDETEXT {MEGEFIELD PATHCOMPONENT} { MEGEFIELD logo}} can this image be generated in the header of 16.10.0.docx. Thank y for your collaboration.


Hi Amine,

Thanks for your inquiry. Could you please attach your TXT file containing sample image data and input Word document here for testing? We will investigate the issue on our end and provide you more information.

Best regards,

Hello again.


So my problem is that i want to use the same PATH variable for both header and body of my template.
The problem is that i have to use different kind of paths :
  • “E:\\PFELV5\\wsApiDoc\\Aspose\\components\\commun\\Components.docx”" for the Header INCLUDETEXT
  • ’E:\PFELV5\wsApiDoc\Aspose\components<b style=“background-color: rgb(255, 255, 255);”>commun\Components.docx’ for the body INCLUDETEXT
I would like to use a unique path for both, as i used to do is that possible ?

I attached some files :
-the PDFs are here to show you the result of the génération using the same PATHCOMPONENT variable for the header & the body
- components.docx the file the INCLUDETEXT should search for
- template.docx the main file where the mergeing is done

Thanks

Hi Amine,


Please also attach your expected documents (DOCX and PDF) here for our reference. We will investigate the structure of your expected documents as to how you want your final output be generated like. You can create expected document using Microsoft Word.

We will then start further investigation into your issue and provide you more information. Thanks for your cooperation.

Best regards,

Hi,


So from the file “template.docx” i want to generate “expectation.pdf”.

The picture and the mail adresse (which is a mergefield) are in the “Components.docx” file (in my previous message).

Thank for the help.

Hi Amine,


You can simply call UpdateFields method after mail merge to fix this issue (see attachment):
<span style=“background-color: rgb(255, 255, 255); font-family: “Courier New”; font-size: 9pt;”>
<span style=“background-color: rgb(255, 255, 255); font-family: “Courier New”; font-size: 9pt;”>Document doc = <span style=“font-family: “Courier New”; font-size: 9pt; color: rgb(0, 0, 128); font-weight: bold;”>new <span style=“background-color: rgb(255, 255, 255); font-family: “Courier New”; font-size: 9pt;”>Document(<span style=“font-family: “Courier New”; font-size: 9pt; color: rgb(0, 128, 0); font-weight: bold;”>“D:<span style=“font-family: “Courier New”; font-size: 9pt; color: rgb(0, 0, 128); font-weight: bold;”>\<span style=“font-family: “Courier New”; font-size: 9pt; color: rgb(0, 128, 0); font-weight: bold;”>temp<span style=“font-family: “Courier New”; font-size: 9pt; color: rgb(0, 0, 128); font-weight: bold;”>\<span style=“font-family: “Courier New”; font-size: 9pt; color: rgb(0, 128, 0); font-weight: bold;”>template.docx”<span style=“background-color: rgb(255, 255, 255); font-family: “Courier New”; font-size: 9pt;”>);
<pre style=“background-color: rgb(255, 255, 255); font-family: “Courier New”; font-size: 9pt;”>
doc.getMailMerge().execute(
new String[]{“PATHCOMPONENT”},
new String[]{" D:\\Temp\\Components.docx"});

doc.updateFields();

doc.save(“D:\temp\awjava-16.11.0.docx”);

Best regards,