将工作簿从 Excel 导出到 XPS

Java 用于将 WORKBOOK 导出到 XPS 文件的库

使用Cells云的导出API导出Java中的Excel文件内部对象工作流程。这是使用Java在线电子表格将WORKBOOK导出为XPS格式文件的专业解决方案。

使用 Cells Cloud SDK for Java 将 WORKBOOK 对象导出为 XPS 格式文件

API
POST
https://api.aspose.cloud/v3.0/cells/export

将 WORKBOOK 对象从 Excel 文件导出到 XPS 文件是一项复杂的任务。将 WORKBOOK 导出到 XPS 格式转换由我们的 Java SDK 执行,同时保留源 WORKBOOK 电子表格的主要结构和逻辑内容。我们的 Java 库是在线将 WORKBOOK 对象导出为 XPS 格式文件的专业解决方案。此Cloud SDK为Java开发者提供了强大的功能和完美的XPS输出。

Java 中的代码示例使用 REST API 将电子表格中的 WORKBOOK 导出为 XPS 格式

// For complete examples and data files, please go to https://github.com/aspose-cells-cloud/aspose-cells-cloud-java/
    import java.io.*;
    import java.util.HashMap;
    import java.util.List;
    import java.util.Base64;
    import com.aspose.cloud.cells.api.*;
    import com.aspose.cloud.cells.model.*;
    public class Export {
        public static void main(String[] args) {
            String format = "xps";
            String objectType = "workbook";
            HashMap<String,File> fileMap = new HashMap<String,File>();
            fileMap.put("Book1.xlsx" ,new File("C:\Book1.xlsx") );
            fileMap.put("myDocument.xlsx" ,new File("C:\myDocument.xlsx") );
            try {
                LightCellsApi cellsApi = new LightCellsApi(System.getenv("ProductClientId"), System.getenv("ProductClientSecret"),"v3.0","https://api.aspose.cloud");
                FilesResult response = cellsApi.postExport(fileMap,objectType, format,null);            
                List<FileInfo> files = response.getFiles();
                String filename = files.get(0).getFilename();
                String fileContent = files.get(0).getFileContent();
                byte[] data = Base64.getDecoder().decode(fileContent);
                OutputStream outputStream = new FileOutputStream(filename);
                outputStream.write(data,0,data.length);
                outputStream.close();
            }catch(Exception exception )
            {
                System.out.print(exception);
            }
        }
    }

如何使用Cells Cloud SDK for Java将对象从Excel WORKBOOK导出到XPS

  1. 注册一个帐户仪表板获取免费API配额和授权详细信息
  2. 使用您的客户端 ID、客户端密钥、基本 URL 和 API 版本初始化 Cells API。
  3. 使用 `postExport` 方法检索结果流。

系统要求

  1. Maven 2.2.0 或更高版本
  2. Java(TM) SE 运行时环境