none
关于C#控制WORD RRS feed

  • 問題

  • 我用C#控制WORD事在输入以下格式时都会产生段落标记请问要怎么用代码删除这些回车标记呀?还有就是怎么插入横线并控制其加粗?

    上述事实,由勘验笔录,问询笔录,现场照片 予以佐证。本单位认为,当事人公民、法人、或者其他组织损坏高速公路附属设施事实清楚,证据充分 依据《路政管理规定》第三十一条 《江西省高速公路管理条例》第十条 《中华人民共和国公路法》第五十三条 之规定,本单位依法作出如下公路赔(补)偿处理决定:

     

     

     

     

            

             当事人赔(补)偿:

    1、木栏10个*11110

    7、有编导38看到*391482

    2、电线杆3根*200600

    8、德科技39客登记*391521

     

     就是中间的空格怎么用C#代码消除掉我生成的代码如下

        Word.Paragraph oPara21;
               oRng = oDoc.Bookmarks.get_Item(ref oEndOfDoc).Range;
               oPara21 = oDoc.Content.Paragraphs.Add(ref oRng);
               oPara21.Range.Font.Size = 12;
               oPara21.Range.Text =  "之规定,本单位依法作出如下公路赔(补)偿处理决定:" ;
               oPara21.Range.Font.Bold = 0;
               oPara21.Format.SpaceAfter = 24;
               oPara21.Range.InsertParagraphAfter();
               oPara21.Range.ParagraphFormat.Alignment = Word.WdParagraphAlignment.wdAlignParagraphLeft;            
               Word.Paragraph oPara43;
               oPara43 = oDoc.Content.Paragraphs.Add(ref oRng);
               oPara43.Range.Font.Size = 12;
               oPara43.Range.Underline = Word.WdUnderline.wdUnderlineSingle;
               oPara43.Range.Text = Pbased;
               oPara43.Range.Font.Bold = 0;
               oPara43.Format.SpaceAfter = 6;
               oPara43.Range.InsertParagraphAfter();
               Word.Paragraph oPara44;
               oPara44 = oDoc.Content.Paragraphs.Add(ref oRng);
               oPara44.Range.Font.Size = 12;
               oPara44.Range.Underline = Word.WdUnderline.wdUnderlineNone;
               oPara44.Range.Text = " 依据";
               oPara44.Range.Font.Bold = 0;
               oPara44.Format.SpaceAfter = 6;
               oPara44.Range.InsertParagraphAfter();
               Word.Paragraph oPara45;
               oPara45 = oDoc.Content.Paragraphs.Add(ref oRng);
               oPara45.Range.Font.Size = 12;
               oPara45.Range.Underline = Word.WdUnderline.wdUnderlineSingle;
               oPara45.Range.Text = CaseCategory + zjss;
               oPara45.Range.Font.Bold = 0;
               oPara45.Format.SpaceAfter = 6;
               oPara45.Range.InsertParagraphAfter();
               Word.Paragraph oPara46;
               oPara46 = oDoc.Content.Paragraphs.Add(ref oRng);
               oPara46.Range.Font.Size = 12;
               oPara46.Range.Underline = Word.WdUnderline.wdUnderlineNone;
               oPara46.Range.Text = " 予以佐证。本单位认为,当事人";
               oPara46.Range.Font.Bold = 0;
               oPara46.Format.SpaceAfter = 6;
               oPara46.Range.InsertParagraphAfter();
               Word.Paragraph oPara47;
               oPara47 = oDoc.Content.Paragraphs.Add(ref oRng);
               oPara47.Range.Font.Size = 12;
               oPara47.Range.Underline = Word.WdUnderline.wdUnderlineSingle;
               oPara47.Range.Text = zj;
               oPara47.Range.Font.Bold = 0;
               oPara47.Format.SpaceAfter = 6;
               oPara47.Range.InsertParagraphAfter();
               Word.Paragraph oPara48;
               oPara48 = oDoc.Content.Paragraphs.Add(ref oRng);
               oPara48.Range.Font.Size = 12;
               oPara48.Range.Underline = Word.WdUnderline.wdUnderlineNone;
               oPara48.Range.Text = "上述事实,由";
               oPara48.Range.Font.Bold = 0;
               oPara48.Format.SpaceAfter = 6;
               oPara48.Range.InsertParagraphAfter();

               Word.Paragraph oPara22;
               oRng = oDoc.Bookmarks.get_Item(ref oEndOfDoc).Range;
               oPara22 = oDoc.Content.Paragraphs.Add(ref oRng);
               oPara22.Range.Font.Size = 12;
               oPara22.Range.Text = "         当事人赔(补)偿:";
               oPara22.Range.Font.Bold = 0;
               oPara22.Format.SpaceAfter = 0;
               oPara22.Range.InsertParagraphAfter();
               oPara22.Range.ParagraphFormat.Alignment = Word.WdParagraphAlignment.wdAlignParagraphLeft;

     

     

     

     

     

     

    2008年9月2日 上午 02:19