Hello,
We need to set dotted line under the dynamic text generate using aspose word template. As per display in attached file that if field’s text length is large than dotted line under the text automatically generated and if field’s text length is small than by default set 4-5 dotted line in word template with blank text. So, How can we achieve our task? Is there any property which we can set in word template?
Best Regards,
Parthesh Mehta
Hi Parthesh,
Thanks for your inquiry. To ensure a timely and accurate response, please attach the following resources here for testing:
- Your input Word document you’re getting this problem with.
- The Aspose.Words generated output document which shows the undesired behavior.
- Your expected Word document. You can create this document using Microsoft Word. We will investigate the structure of your target document as to how you would like your final document be generated like.
- Please share piece of code you used to generate output document on your side.
As soon as you get these pieces of information ready for us, we’ll start investigation into your issue and provide you more information.
Best regards,
Hi Hafeez,
I have attached piece of code with word document and expected pdf document .Please go through it and let me know if there is any solution available for this.
Kind Regards
Parthesh Mehta
Hi Parthesh,
Thanks for your inquiry. We are checking with this scenario and will get back to you soon.
Best regards,
Hi Parthesh,
Thanks for being patient. You can insert dotted text inside content controls simply by using the following code:
Document doc = new Document(@"C:\Temp\MedicalAdmissionCertificate.docx");
NodeCollection sdtNodes = doc.GetChildNodes(NodeType.StructuredDocumentTag, true);
foreach(StructuredDocumentTag sdt in sdtNodes)
{
if (sdt.SdtType == SdtType.PlainText)
{
sdt.RemoveAllChildren();
Run run = new Run(doc, "new text goes here");
run.Font.Underline = Underline.Dotted;
run.Font.UnderlineColor = Color.Green;
sdt.AppendChild(run);
}
}
doc.Save(@"C:\Temp\out.pdf");
I hope, this helps.
Best regards,