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

Free Support Forum - aspose.com

Unable to add a text outside control


I have a word document with DateTimePicker control in it. When I try to add a text to this document, the text appears INSIDE the control. I am using this code:
var doc1 = new Document(@“C:\Date_Picker_only.docx”);
var builder1 = new Aspose.Words.DocumentBuilder(doc1);
builder1.Writeln(“wrinting test line”);
builder1.Write(“Another line”);
Is there a way to add text which will be OUTSIDE the control?
Thank you,

Hi Alexei,

Thanks for your inquiry. You can achieve this by executing the following code:

Document doc = new
Document(MyDir + @“Date_Picker_only.docx”);

DocumentBuilder builder = new DocumentBuilder(doc);

Node lastNode = doc.LastSection.Body.LastChild;

lastNode.ParentNode.InsertAfter(new Paragraph(doc), lastNode);


builder.Write("Some text");

doc.Save(MyDir + @“out.docx”);

I hope, this helps.

Best regards,

It works!

Thank you