zoukankan      html  css  js  c++  java
  • 将word内容追击到新建WORD文档

    将word内容追击到新建WORD文档

                Microsoft.Office.Interop.Word._Application wordApp = new Microsoft.Office.Interop.Word.Application();
                wordApp.Visible = false;
                Object Nothing = System.Reflection.Missing.Value;
                Microsoft.Office.Interop.Word._Document document = new DocumentClass();
                Microsoft.Office.Interop.Word._Document tempdocument = new DocumentClass();
                object objTemplate = Server.MapPath(@"~\wordModeldemo.doc");
    
                document = wordApp.Documents.Add(ref Nothing, ref Nothing, ref Nothing, ref Nothing);
                for (int i = 0; i < 3; i++)
                {
                    //document.Content.
                    if (i > 0)
                    {
                        Microsoft.Office.Interop.Word.Paragraph para;
                        para = document.Content.Paragraphs.Add(ref Nothing);
                        object pBreak = (int)WdBreakType.wdSectionBreakNextPage;
                        para.Range.InsertBreak(ref pBreak);
    
                    }
                    tempdocument = wordApp.Documents.Open(objTemplate);
    
                    Range range = tempdocument.Range(ref Nothing, ref Nothing);
                    range.Copy();
                    document.Paragraphs.Last.Range.PasteAndFormat(WdRecoveryType.wdFormatOriginalFormatting);
                }
    本博客有部分内容来自网络,如有问题请联系:hebeilijianghua@qq.com,并注明来自博客园。
  • 相关阅读:
    JS 百度地图路书---动态路线
    jQuery---创建和添加节点
    CSS基础
    第一篇:前端知识之HTML内容
    JS高级---为内置对象添加原型方法
    JS DOM属性+JS事件
    Vue-router
    vue使用kkfileview文件预览功能
    JS高级---案例:验证密码的强度
    promise是怎么来的?
  • 原文地址:https://www.cnblogs.com/leebokeyuan/p/7614340.html
Copyright © 2011-2022 走看看