Click here to Skip to main content
15,888,521 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
I am creating an unwanted line of 11pt font between a blank 10pt line and another line with "Social Assessment" on it.

            //first line
            Word.Paragraph paragraph;
            paragraph = oDoc.Content.Paragraphs.Add(ref oMissing);
            Word.Range para = paragraph.Range;
            para.Font.Size = 10;
            para.Font.Name = "Arial";
            para.Font.Bold = 1;
            para.Text = "\r\n";
            paragraph.Format.SpaceAfter = 24;
            para.InsertParagraphAfter();
            para.ParagraphFormat.Alignment = Word.WdParagraphAlignment.wdAlignParagraphCenter;
            
///////////////Here is the line of 10pt font

            //next line
            Word.Paragraph oPara1;
            oPara1 = oDoc.Content.Paragraphs.Add(ref oMissing);
            Word.Range rng = oPara1.Range;
            rng.Font.Size = 14;
            rng.Font.Name = "Arial";
            rng.Font.Bold = 1;
            rng.Text = "SOCIAL ASSESSMENT";
            oPara1.Format.SpaceAfter = 24;    //24 pt spacing after paragraph.
            rng.InsertParagraphAfter();
            rng.ParagraphFormat.Alignment = Word.WdParagraphAlignment.wdAlignParagraphCenter;



What is causing the problem/ how can I get rid of it? Thanks.
Posted
Updated 2-Apr-12 18:10pm
v3

Hi, Check this this link : Summarize C# Control Word Skills[^]
 
Share this answer
 
You are using multiple paragraphs: But paragraphs are made to separate two different blocks.

Use one paragraph instead and add multiple lines with "para.Inlines.Add(new Run("Hello"));".
You can style the run element, too.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900