MATLAB爱好者论坛-LabFans.com

MATLAB爱好者论坛-LabFans.com (https://www.labfans.com/bbs/index.php)
-   资料存档 (https://www.labfans.com/bbs/forumdisplay.php?f=72)
-   -   如何使用Word Automation获取页面范围 (https://www.labfans.com/bbs/showthread.php?t=22719)

poster 2019-12-10 16:49

如何使用Word Automation获取页面范围
 
您如何使用办公自动化在Microsoft Word中找到第n页的范围?似乎没有getPageRange(n)函数,并且不清楚如何划分它们。


回答:
这是从VBA进行的操作,要转换为Matlab COM调用应该相当简单。

Public Sub DemoPerPageText() Dim i As Integer Dim totalPages As Integer Dim bmRange As Range totalPages = Selection.Information(wdNumberOfPagesInDocument) For i = 1 To totalPages Set bmRange = ActiveDocument.Bookmarks("\Page").Range Debug.Print CStr(i) & " : " & bmRange.Text & vbCrLf Next i End Sub

[url=https://stackoverflow.com/questions/1076348]更多&回答...[/url]


所有时间均为北京时间。现在的时间是 23:27

Powered by vBulletin
版权所有 ©2000 - 2025,Jelsoft Enterprises Ltd.