-
Notifications
You must be signed in to change notification settings - Fork 19
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add text in word Watermark in DocumentAssembler #62
Comments
You may start from posting here code sample that you have used. |
DocumentWaterMark.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>[email protected]</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 <##> on the watermark. 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 |
Did anyone suceeded in addng a watermark to the template, with a tranformation and make it work?
Mine was like this
The text was updated successfully, but these errors were encountered: