zoukankan      html  css  js  c++  java
  • Add to word and save

                Object oMissing = System.Reflection.Missing.Value;

                Object oFalse = false;

                Word.Application oWord = new Word.Application();
                Word.Document oWordDoc = new Word.Document();
                oWord.Visible = true;
                oWordDoc = oWord.Documents.Add(ref oMissing, ref oMissing, ref oMissing, ref oMissing);       
                Object start = 0;
                Object end = 0;
                Word.Range rng1 = oWordDoc.Range(ref start, ref end);

                rng1.Select();

                s4 = "The text to insert at the end of word"

                rng1.InsertAfter(s4);

                Object oSaveAsFile = (Object)"File location   ----  C:\\SampleDoc.docx";
                oWordDoc.SaveAs(ref oSaveAsFile, ref oMissing, ref oMissing, ref oMissing, ref oMissing, ref oMissing, ref oMissing, ref oMissing, ref oMissing, ref oMissing, ref oMissing, ref oMissing, ref oMissing, ref oMissing, ref oMissing, ref oMissing);

                 oWordDoc.Close(ref oFalse, ref oMissing, ref oMissing);
                //QUITTING THE APPLICATION
                oWord.Quit(ref oMissing, ref oMissing, ref oMissing);
        

  • 相关阅读:
    ural 1227 dfs判环&求最长路
    uva 11990 块状链表
    图论·二分图
    图论·双连通分量
    图论·欧拉迹
    组合博弈
    解题策略·状态精简
    组合计数·棋盘统计
    组合计数·图形统计
    组合计数·经典序列问题
  • 原文地址:https://www.cnblogs.com/greencolor/p/1649977.html
Copyright © 2011-2022 走看看