Open luizfbicalho opened 1 year ago
You may start from posting here code sample that you have used.
DocumentWaterMark.docx DocumentWaterMark_Transformed.docx
I Uploaded the files and this is the xml
<Data>
<Name>Abelardo Barbosa</Name>
<Address>Rua Montes Passados, 1550</Address>
<Phone>(11)9999-9999</Phone>
<Email>aberlardo@tvz.com.br</Email>
<WaterMark>TEXTO QUE PRECISO PARA COLOCAR DE FUNDO NO DOCUMENTO</WaterMark>
</Data>
This is the template image
and this is the result image
As you can see the Assembled document still have the <#
Is that possible?
What code/class do you use (and how)?
This is the code, just a simple AssembleDocument @sergey-tihon
var wmlDoc = new WmlDocument("template.docx", template);
var element = XElement.Parse(orig);
bool templateError;
var wmlAssembledDoc = DocumentAssembler.AssembleDocument(wmlDoc, element, out templateError);
return wmlAssembledDoc.DocumentByteArray;
I believe that watermarks are not supported yet. If you decide to implement this, you need to take a look inside your template, find markup for the watermark and then extend content transformation to the property handle transformation - https://github.com/sergey-tihon/Clippit/blob/master/OpenXmlPowerTools/Word/DocumentAssembler.cs#L1152
The watermark is inside a shape, the xml is this
<v:textpath style="font-family:"Calibri";font-size:1pt" string="<#<Content Select="./WaterMark"/>#>" xmlns:v="urn:schemas-microsoft-com:vml" />
I would work fine if it were a subnode but as an string it's too unsafe to change, do you have any other idea?
I see no other options rather than special case for string
attribute of v:textpath
Did anyone suceeded in addng a watermark to the template, with a tranformation and make it work?
Mine was like this