博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
将word内容追击到新建WORD文档
阅读量:7255 次
发布时间:2019-06-29

本文共 1317 字,大约阅读时间需要 4 分钟。

将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(@"~\\wordModel\demo.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);            }

 

转载于:https://www.cnblogs.com/leebokeyuan/p/7614340.html

你可能感兴趣的文章
转 Linux文件管理
查看>>
Android中资源文件assets和res下面raw文件的使用不同点
查看>>
汉子字符转换成大写英文字母开头。。
查看>>
SQL优化(数据库的优化)
查看>>
android学习摘记——关于android ListView的美化
查看>>
Python--day72--ajax简介
查看>>
初识Python(windows)——下载、安装、使用
查看>>
NetCore Tag Helpers 和 HTML Helpers 和 Web 服务器控件比较
查看>>
Hadoop常用命令
查看>>
vue-cli 脚手架项目简介(一) - package.json
查看>>
js的数据类型及类型转换
查看>>
wpa_cli 关联无线网络
查看>>
MySQL批量数据脚本示例
查看>>
Can realize the needs of the individual, MBT Sini
查看>>
规则引擎以及blaze 规则库的集成初探之二——JSR94 的规则引擎API和实现
查看>>
core dump文件生成
查看>>
同步异步, 阻塞和非阻塞
查看>>
SQL查询案例:行列转换[行转列, 使用 CASE WHEN 处理]
查看>>
XML文档注释
查看>>
【MongoDB】1、MongoDB for Java
查看>>