如題:想將Fsinfos[0].FullName 這個檔案中的頁面設定 賦值給 當前檔案第二節,但
一、試了試下面代碼,一點效果沒有
Word.Document oDocument_Other = App.Documents.Open(Fsinfos[0].FullName);
Word.PageSetup ResultPageSetup = oDocument_Other.PageSetup;
oDocument.Sections[2].PageSetup = ResultPageSetup;
二、試了試下面代碼,直接報錯
oDocument.Sections[2].PageSetup =oDocument_Other.PageSetup.Clone()
三、下面代碼可行,但太費勁了(因為屬性實在太多),不知可有好辦法?
oDocument.Sections[2].PageSetup.TopMargin =28.3f;
oDocument.Sections[2].PageSetup.BottomMargin =14.15f;
oDocument.Sections[2].PageSetup.RightMargin = oDocument_Other.PageSetup.RightMargin;
oDocument.Sections[2].PageSetup.LeftMargin = oDocument_Other.PageSetup.LeftMargin;
uj5u.com熱心網友回復:
微軟自帶? 可能版本問題
uj5u.com熱心網友回復:
對呀,就是想用C#操作Word
uj5u.com熱心網友回復:
在word錄制一個宏,再照抄下代碼。uj5u.com熱心網友回復:
最近在研究 NOPI ,樓主可以去github 下載瞅瞅,感覺 還蠻好用的。uj5u.com熱心網友回復:
https://github.com/tonyqus/npoi.gituj5u.com熱心網友回復:
想過,沒用,原因:
1、一直用office,已經熟悉基本操作(雖然時不時加載出問題); 而NOPI一點沒接觸過,還要從頭學
就是沒有 為了一個功能而學習一套插件 的動力
2、感覺NOPI還是不成熟,比如說列印功能就沒有;
等成熟再考慮吧,
謝謝你的建議。
轉載請註明出處,本文鏈接:https://www.uj5u.com/net/22856.html
標籤:C#
上一篇:DevExpress提示:無法將型別為"system.drawing.color"的物件強制轉換為型別"system.string"
下一篇:.net core WebApi 接收不到 application/json; charset=utf-8 的值
