• 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);
        

  • 相关阅读:
    python读取配置文件
    日志截取
    QJsonObject
    OpenStack
    生成器迭代器正则视频笔记
    使用Qt.createComponent 动态加载组件
    linux 远程执行命令
    Django 建立工程连接数据库
    arm基础1
    QSetting的用法
  • 原文地址:https://www.cnblogs.com/greencolor/p/1649977.html
Copyright © 2020-2023  润新知