Locked 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