HTML
JPG
PDF
XML
XLSX
TIFF
在 C++ 中创建 TIFF 文件
无需使用 C++ 库,以编程方式创建本机和高性能 TIFF 文件,无需 Micorsoft Office。
使用 C++ 创建 TIFF 文件
如何创建 TIFF 文件?使用 Aspose.Cells for C++ 库,您只需几行代码即可以编程方式轻松创建 TIFF 文件。 Aspose.Cells for C++ 能够构建跨平台应用程序,能够生成、修改、转换、呈现和打印所有 Excel 文件。C++ Excel API 不仅可以在电子表格格式之间进行转换,还可以将 Excel 文件呈现为图像,PDF, HTML, ODS, CSV, SVG, JSON, WORD, PPT 等等,因此它是以行业标准格式交换文档的完美选择。您可以直接下载其最新版本,只需打开 NuGet 包管理器,搜索 Aspose.Cells.Cpp 并安装。您也可以从包管理器控制台使用以下命令。
命令
PM> Install-Package Aspose.Cells.Cpp
如何在 C++ 中创建 TIFF
开发人员只需几行代码即可在正在运行的报告应用程序中轻松创建、加载、修改和转换 TIFF 文件以进行数据处理。
- 创建 Workbook 类的对象。
- 将第一张工作表放入 Worksheet 对象中。
- 使用 Worksheet.GetCells() 方法将工作表的单元格放入 Cells 对象中。
- 使用 Cells.Get() 方法将工作表的所需单元格访问到 Cell 对象中。
- 使用 Cell.PutValue() 方法将值输入单元格。
- 使用 Save() 方法将工作簿保存为 .tiff 文件。
示例代码显示如何在 C++ 中创建 TIFF 文件。
Aspose::Cells::Startup();
// Create an object of the Workbook class.
Workbook wkb;
// Get the first sheet into an Worksheet object.
WorksheetCollection wsc = wkb.GetWorksheets();
Worksheet ws = wsc.Get(0);
// Use Worksheet.GetCells() method to get the cells of the worksheet into an Cells object.
Cells cells = ws.GetCells();
// Use Cells.Get() method to access the desired cell of the worksheet into an Cell object.
Cell cell00 = cells.Get(0, 0);
Cell cell01 = cells.Get(0, 1);
Cell cell10 = cells.Get(1, 0);
Cell cell11 = cells.Get(1, 1);
// Use Cell.PutValue() method to input value into the cell.
cell00.PutValue(u"ColumnA");
cell01.PutValue(u"ColumnB");
cell10.PutValue(u"ValueA");
cell11.PutValue(u"ValueB");
// Save workbook to resultFile folder
wkb.Save(u"created_one.tiff");
Aspose::Cells::Cleanup();
系统要求
在运行 C++ 转换示例源代码之前,请确保您满足以下先决条件。
- Microsoft Windows 或与 C++ 运行环境兼容的操作系统,适用于 Windows 32 位、Windows 64 位和 Linux 64 位。
- 在您的项目中添加对 Aspose.Cells for C++ DLL 的引用。
TIFF 什么是TIFF文件格式
TIFF 或 TIF(标记图像文件格式)表示光栅图像,可用于符合此文件格式标准的多种设备。它能够在多个颜色空间中描述二值、灰度、调色板颜色和全彩色图像数据。它支持有损和无损压缩方案,以便为使用该格式的应用程序在空间和时间之间进行选择。该格式不依赖于机器,并且不受处理器、操作系统或文件系统等限制。
阅读更多