在 Ruby 中管理分页符

Aspose.Cells - 管理分页符

添加分页符

添加分页符使用Aspose.Cells Java 红宝石, 称呼添加分页符的方法分页符模块。您可以在下面看到代码示例。

红宝石代码

 def add_page_breaks(workbook)

    worksheets = workbook.getWorksheets()

    worksheet = worksheets.get(0)

    h_page_breaks = worksheet.getHorizontalPageBreaks()

    h_page_breaks.add("Y30")



    v_page_breaks = worksheet.getVerticalPageBreaks()

    v_page_breaks.add("Y30")

    # Saving the modified Excel file in default (that is Excel 2003) format

    workbook.save(@data_dir + "Add Page Breaks.xls")

    puts "Add page breaks, please check the output file."

end   

清除所有分页符

使用清除所有分页符Aspose.Cells Java 红宝石, 称呼clear_all_page_breaks的方法分页符模块。您可以在下面看到代码示例。

红宝石代码

 def clear_all_page_breaks(workbook)

    workbook.getWorksheets().get(0).getHorizontalPageBreaks().clear()

    workbook.getWorksheets().get(0).getVerticalPageBreaks().clear()

    # Saving the modified Excel file in default (that is Excel 2003) format

    workbook.save(@data_dir + "Clear All Page Breaks.xls")

    puts "Clear all page breaks, please check the output file."

end 

删除特定分页符

使用删除特定分页符Aspose.Cells Java 红宝石, 称呼删除分页符的方法分页符模块。您可以在下面看到代码示例。

红宝石代码

 def remove_page_break(workbook)

    worksheets = workbook.getWorksheets()

    worksheet = worksheets.get(0)



    h_page_breaks = worksheet.getHorizontalPageBreaks()

    h_page_breaks.removeAt(0)



    v_page_breaks = worksheet.getVerticalPageBreaks()

    v_page_breaks.removeAt(0)

    # Saving the modified Excel file in default (that is Excel 2003) format

    workbook.save(@data_dir + "Remove Page Break.xls")

    puts "Remove page break, please check the output file."

end 

下载运行代码

下载**管理分页符 (Aspose.Cells)**来自以下任何社交编码网站: