本文介紹示範檔案版面設定相關進階介面,包含版面設定對象、頁面寬度、頁面比例和頁面高度。
版面設定對象
文法
運算式.ActivePresentation.PageSetup運算式:文件類型應用對象
樣本
async function example() { await instance.ready(); const app = instance.Application; //簡報對象 const presentation = await app.ActivePresentation; //版面設定對象 const pageSetup = await presentation.PageSetup; }
頁面寬度
文法
運算式.ActivePresentation.PageSetup.SlideWidth運算式:文件類型應用對象
樣本
async function example() { await instance.ready(); const app = instance.Application; //簡報對象 const presentation = await app.ActivePresentation; //版面設定對象 const pageSetup = await presentation.PageSetup; //擷取寬度 const slideWidth = await pageSetup.SlideWidth; console.log(slideWidth); }
頁面高度
文法
運算式.ActivePresentation.PageSetup.SlideHeight運算式:文件類型應用對象
樣本
async function example() { await instance.ready(); const app = instance.Application; //簡報對象 const presentation = await app.ActivePresentation; //版面設定對象 const pageSetup = await presentation.PageSetup; //擷取高度 const slideHeight = await pageSetup.SlideHeight; console.log(slideHeight); }
頁面比例
文法
運算式.ActivePresentation.PageSetup.SlideRatio運算式:文件類型應用對象
傳回值
屬性
資料類型
描述
Ratio
number
頁面比例。
樣本
async function example() { await instance.ready(); const app = instance.Application; //簡報對象 const presentation = await app.ActivePresentation; //版面設定對象 const pageSetup = await presentation.PageSetup; //擷取比例 const slideRatio = await pageSetup.SlideRatio; console.log(slideRatio); }