2015-09-25 33 views
2

設置Word文檔頁面佈局兩列如何設置Word文檔頁面佈局一般從MATLAB 2列,如何從MATLAB

File='C:\Users\ies\Documents\MATLAB\test.docx'; %use full path 
[pth,name,ext]=fileparts(file); 
w=Word(file,true); %create document and make visible 

addText(w,'Introduction','Heading 1',2); %create a heading, 2 spaces after 
addText(w,recognizedText); %add some text 
newline(w,6); %6 newlines 
pic=sprintf('%s/fig.png',pth); 

saveAs(w,file); 

上面的代碼保存在正常模式下的Word文件中的文本,但我需要兩列。

回答

0

Word函數不是標準的MATLAB函數。沒有提供它來自哪裏的詳細信息,不可能肯定地說明它的返回值w是或者如何與它進行交互。但是,由於其他非標準函數似乎將它視爲Word Document對象,因此我們假設它是其中一個對象的COM接口。

在這種情況下,你可以使用的列數設置爲二:

w.ActiveWindow.Selection.Sections.First.PageSetup.TextColumns.SetCount(2)