开发者

How to duplicate .doc page

开发者 https://www.devze.com 2023-04-06 16:50 出处:网络
I have a microsoft word document with single page. I need to make more pages is that document that is the sam开发者_运维百科e as first page.If you add a reference to Microsoft Word, you can use Micros

I have a microsoft word document with single page. I need to make more pages is that document that is the sam开发者_运维百科e as first page.


If you add a reference to Microsoft Word, you can use Microsoft.Office.Interop.Word to edit and create word documents. The easiest way to copy pages is probably to create a new file and then insert the original file as many times as you need pages. using Microsoft.Office.Interop.Word;

object missing = System.Reflection.Missing.Value;
object StartPoint = 0;

ApplicationClass WordApp = new ApplicationClass();
Document WordDoc = WordApp.Documents.Add(ref missing, ref missing, 
                                         ref missing, ref missing);
Range MyRange = WordDoc.Range(ref StartPoint, ref missing);

Then use InsertFile with your original file as many times as you need pages.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号