By Mike Willis - 5 Years Ago
|
I need to add fake data (Lorem) to my word documents. What is the best way to accomplish this? Thanks in advance. Mike
|
By Nevron Support - 5 Years Ago
|
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.
|
By Mike Willis - 5 Years Ago
|
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
|
By Nevron Support - 5 Years Ago
|
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...
|