Profile Picture

What is the recommended what to pragmatically add text to a Word document using...

Posted By Mike Willis 2 Years Ago

What is the recommended what to pragmatically add text to a Word...

Author
Message
Mike Willis
Posted 2 Years Ago
View Quick Profile
Forum Newbie

Forum Newbie (0 reputation)Forum Newbie (0 reputation)Forum Newbie (0 reputation)Forum Newbie (0 reputation)Forum Newbie (0 reputation)Forum Newbie (0 reputation)Forum Newbie (0 reputation)Forum Newbie (0 reputation)Forum Newbie (0 reputation)

Group: Forum Members
Last Active: 2 Months Ago
Posts: 18, Visits: 108
I need to add fake data (Lorem) to my word documents.
What is the best way to accomplish this?
Thanks in advance.
Mike

Nevron Support
Posted 2 Years Ago
View Quick Profile
Supreme Being

Supreme Being (4,093 reputation)Supreme Being (4,093 reputation)Supreme Being (4,093 reputation)Supreme Being (4,093 reputation)Supreme Being (4,093 reputation)Supreme Being (4,093 reputation)Supreme Being (4,093 reputation)Supreme Being (4,093 reputation)Supreme Being (4,093 reputation)

Group: Forum Members
Last Active: 6 hours ago
Posts: 2,965, Visits: 3,372
Hi Mike,
We recommend to add the text as it should be present in control DOM tree - for example:
   NRichTextView richTextView = (NRichTextView)nRichTextViewWithRibbonControl1.Widget.GetFirstDescendant(NRichTextView.NRichTextViewSchema);
    richTextView.Content.Sections.Clear();

    NSection section = new NSection();
    richTextView.Content.Sections.Add(section);

    NParagraph paragraph = new NParagraph();
    section.Blocks.Add(paragraph);

    NTextInline boldInline = new NTextInline("Bold Text.");
    boldInline.FontStyleBold = true;
    paragraph.Inlines.Add(boldInline);

    NTextInline italicInline = new NTextInline("Italic Text.");
    italicInline.FontStyleItalic = true;
    paragraph.Inlines.Add(italicInline);
in short you need to create a section (controls pages) and then add paragraphs or tables to it. For more information you can check out Rich Text Editor \ Document Model topics which describe how a document is structured. 
Hope this helps - let us know if you meet any problems or have any questions.




Best Regards,
Nevron Support Team



Mike Willis
Posted 2 Years Ago
View Quick Profile
Forum Newbie

Forum Newbie (0 reputation)Forum Newbie (0 reputation)Forum Newbie (0 reputation)Forum Newbie (0 reputation)Forum Newbie (0 reputation)Forum Newbie (0 reputation)Forum Newbie (0 reputation)Forum Newbie (0 reputation)Forum Newbie (0 reputation)

Group: Forum Members
Last Active: 2 Months Ago
Posts: 18, Visits: 108
Thanks that worked perfectly.
One more thing.  When i add the text i get a Save prompt.  How can i suppress the save prompt?
Thanks in advance
Mike willis 

Nevron Support
Posted 2 Years Ago
View Quick Profile
Supreme Being

Supreme Being (4,093 reputation)Supreme Being (4,093 reputation)Supreme Being (4,093 reputation)Supreme Being (4,093 reputation)Supreme Being (4,093 reputation)Supreme Being (4,093 reputation)Supreme Being (4,093 reputation)Supreme Being (4,093 reputation)Supreme Being (4,093 reputation)

Group: Forum Members
Last Active: 6 hours ago
Posts: 2,965, Visits: 3,372
Hi Mike,
When do you get this message? In general the rich text view should not display "save as" message. You can clear the Modified document flag:
richTextView.document.Modified = false;
if you want to suppress it, but we're just curious how do you get it in the first place... 

Best Regards,
Nevron Support Team





Similar Topics


Reading This Topic