翻譯|使用教程|編輯:李顯亮|2020-07-28 10:28:08.630|閱讀 1246 次
概述:Aspose.Cells提供了一個(gè)Workbook類(lèi),提供了PAGESETUP用于設(shè)置工作表的頁(yè)面設(shè)置選項(xiàng)屬性。所述PAGESETUP 屬性是的目的PAGESETUP類(lèi),使開(kāi)發(fā)一種用于印刷工作表設(shè)置不同的頁(yè)面布局選項(xiàng)。該P(yáng)AGESETUP類(lèi)提供用于設(shè)置頁(yè)面設(shè)置選項(xiàng)的各種屬性和方法。
# 界面/圖表報(bào)表/文檔/IDE等千款熱門(mén)軟控件火熱銷(xiāo)售中 >>
相關(guān)鏈接:
Aspose.Cells for .NET是Excel電子表格編程API,可加快電子表格管理和處理任務(wù),支持構(gòu)建具有生成,修改,轉(zhuǎn)換,呈現(xiàn)和打印電子表格功能的跨平臺(tái)應(yīng)用程序。
在接下來(lái)的系列教程中,將為開(kāi)發(fā)者帶來(lái)Aspose.Cells for .NET的一系列使用教程,例如關(guān)于加載保存轉(zhuǎn)換、字體、渲染、繪圖、智能標(biāo)記等等。本文重點(diǎn)介紹如何設(shè)置頁(yè)面邊距。
>>Aspose.Cells for .NET已經(jīng)更新至v20.7,添加FilterString()條件支持,支持對(duì)所有PivotField進(jìn)行循環(huán),提升Worksheet.Cells.RemoveDuplicates工作性能,發(fā)現(xiàn)4處異常情況,點(diǎn)擊下載體驗(yàn)
使用PageSetup 類(lèi)成員設(shè)置頁(yè)邊距(左,右,上,下)。下面列出了一些用于指定頁(yè)邊距的方法:
// The path to the documents directory. string dataDir = RunExamples.GetDataDir(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType); // Create a workbook object Workbook workbook = new Workbook(); // Get the worksheets in the workbook WorksheetCollection worksheets = workbook.Worksheets; // Get the first (default) worksheet Worksheet worksheet = worksheets[0]; // Get the pagesetup object PageSetup pageSetup = worksheet.PageSetup; // Set bottom,left,right and top page margins pageSetup.BottomMargin = 2; pageSetup.LeftMargin = 1; pageSetup.RightMargin = 1; pageSetup.TopMargin = 3; // Save the Workbook. workbook.Save(dataDir + "SetMargins_out.xls");
可以在頁(yè)面上水平和垂直居中放置某些內(nèi)容。為此,PageSetup 類(lèi)有一些有用的成員CenterHorizontally 和CenterVertically。
// The path to the documents directory. string dataDir = RunExamples.GetDataDir(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType); // Create a workbook object Workbook workbook = new Workbook(); // Get the worksheets in the workbook WorksheetCollection worksheets = workbook.Worksheets; // Get the first (default) worksheet Worksheet worksheet = worksheets[0]; // Get the pagesetup object PageSetup pageSetup = worksheet.PageSetup; // Specify Center on page Horizontally and Vertically pageSetup.CenterHorizontally = true; pageSetup.CenterVertically = true; // Save the Workbook. workbook.Save(dataDir + "CenterOnPage_out.xls");
使用PageSetup 類(lèi)成員(例如HeaderMargin 和FooterMargin)設(shè)置頁(yè)眉和頁(yè)腳頁(yè)邊距。
// The path to the documents directory. string dataDir = RunExamples.GetDataDir(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType); // Create a workbook object Workbook workbook = new Workbook(); // Get the worksheets in the workbook WorksheetCollection worksheets = workbook.Worksheets; // Get the first (default) worksheet Worksheet worksheet = worksheets[0]; // Get the pagesetup object PageSetup pageSetup = worksheet.PageSetup; // Specify Header / Footer margins pageSetup.HeaderMargin = 2; pageSetup.FooterMargin = 2; // Save the Workbook. workbook.Save(dataDir + "CenterOnPage_out.xls");
本站文章除注明轉(zhuǎn)載外,均為本站原創(chuàng)或翻譯。歡迎任何形式的轉(zhuǎn)載,但請(qǐng)務(wù)必注明出處、不得修改原文相關(guān)鏈接,如果存在內(nèi)容上的異議請(qǐng)郵件反饋至chenjj@fc6vip.cn