word left indent selection from c# code through Rich Text box
-
Wednesday, May 16, 2012 4:24 AM
Hi.....I used richtextbox to edit result and send result to word document.....I want display the result heading and result.. I used alignment for heading and result. Alignment property is applied to heading, but this property is not applied to result. Result is being started at left side just after 10px of the starting page.. I need to increase the indent of the paragraph of the result...I used code to this purpose at printing report page...I display code below...
first paragraph for result heading, second paragraph for result.... I need increase paragraph indent of the result.
Microsoft.Office.Interop.Word.Paragraph oPara1;
object oRng = objWordDocumentForXray.Bookmarks.get_Item(ref oEndOfDoc).Range;
oPara1 = objWordDocumentForXray.Content.Paragraphs.Add(ref oRng);
oPara1.Range.Text = sTestName;
oPara1.Alignment = WdParagraphAlignment.wdAlignParagraphCenter;
oPara1.Format.SpaceAfter = 6;
oPara1.Range.InsertParagraphAfter();
Microsoft.Office.Interop.Word.Paragraph oPara2;
object oRng2 = objWordDocumentForXray.Bookmarks.get_Item(ref oEndOfDoc).Range;
oPara2 = objWordDocumentForXray.Content.Paragraphs.Add(ref oRng2);
Clipboard.SetData(DataFormats.Rtf, sResult);
//oPara2.Alignment = WdParagraphAlignment.wdAlignParagraphCenter;
oPara2.Format.SpaceAfter = 6;
oPara2.Range.InsertParagraphAfter();
oPara2.Range.ParagraphFormat.LeftIndent = objWordApplicationForXray.InchesToPoints(3F);
All Replies
-
Wednesday, May 16, 2012 6:17 AM
Would you not mind to ask your question to Word for Developers or General Office Development for prompt answer?
Seems this is achievable as below links says :
http://msdn.microsoft.com/en-us/library/microsoft.office.interop.word.rows.setleftindent.aspx
I am using ASPOSE component to do similar kind of functionalities which may help you.
http://www.aspose.com/docs/display/wordsnet/Specifying+Formatting
Lingaraj Mishra
- Proposed As Answer by Mike FengMicrosoft Contingent Staff, Moderator Thursday, May 17, 2012 7:03 AM
- Marked As Answer by Mike FengMicrosoft Contingent Staff, Moderator Thursday, May 31, 2012 11:22 AM

