冰蓝科技
|
028-81705109
|
|
微信扫一扫
|

Spire.Cloud 纯前端文档控件

Spire.Office 8.6.0 已发布。在该版本中,Spire.PDF 支持转换多页 PDF 文档为单个 SVG 文件;Spire.XLS 新增了优化删除行的速度的方法;Spire.Presentation 支持为 TextFrame 设置栏数。此外,许多已知问题也在该版本中被成功修复。详情请阅读以下内容。

该版本涵盖了最新版的 Spire.Doc,Spire.PDF,Spire.XLS,Spire.Email,Spire.DocViewer, Spire.PDFViewer,Spire.Presentation,Spire.Spreadsheet, Spire.OfficeViewer, Spire.DocViewer, Spire.Barcode, Spire.DataExport。

版本信息如下:

获取Spire.Office 8.6.0请点击:

https://www.e-iceblue.cn/Downloads/Spire-Office-NET.html


Spire.PDF

新功能:

问题修复:


Spire.XLS

新功能:

问题修复:


Spire.Presentation

新功能:

问题修复:


Spire.Doc

问题修复:

Spire.Presentation 8.6.0已发布。本次更新支持为TextFrame设置栏数。此外,该版本还修复了一些已知问题,如:修复了应用程序在拆分合并单元格时,抛出“Merged cells found.”的问题。详情请阅读以下内容。

新功能:

问题修复:


获取 Spire.Presentation 8.6.0请点击:

https://www.e-iceblue.cn/Downloads/Spire-Presentation-NET.html

Spire.PDF 9.6.0 已发布。该版本支持转换多页 PDF 文档为单个 SVG 文件。同时,该版本还增强了 PDF 到 Word、Excel 和 PPT 以及 OFD 到 PDF 的转换功能。此外,许多已知问题也在该版本被成功修复,如查找文本失败的问题。详情请阅读以下内容。

新功能:

问题修复:


获取 Spire.PDF 9.6.0请点击:

https://www.e-iceblue.cn/Downloads/Spire-PDF-NET.html

超链接是 Excel 中一个强有力的工具,它允许用户连接 Excel 文件的不同部分或链接到外部资源,例如网站、电子邮件地址或其他文件。它们为用户提供了一种在工作表内或不同工作表之间导航的快捷方式。除了便于导航之外,超链接还可以提供与文件中的数据相关的附加上下文或资源。例如,您可以链接到一个网站,该网站提供了有关工作表中所列出的特定产品的更多信息,可以帮助读者可以更深入地了解该产品。在本文中,我们将探讨如何向 Excel 添加超链接,特别是如何使用 Spire.XLS for C++ 在 C++ 中向 Excel 文件添加文本超链接和图像超链接

安装 Spire.XLS for C++

有两种方法可以将 Spire.XLS for C++ 集成到您的应用程序中。一种方法是通过 NuGet 安装它,另一种方法是从我们的网站下载包并将库复制到您的程序中。通过 NuGet 安装更简单,更推荐使用。您可以通过访问以下链接找到更多详细信息。

如何将 Spire.XLS for C++ 集成到 C++ 程序中

在 Excel 中添加文本超链接

Excel 中的文本超链接是一个单词或短语,您可以单击它跳到特定位置,例如 Excel 文件的不同部分、电子邮件地址、网页或外部文件。以下步骤说明如何使用 Spire.XLS for C++ 将文本超链接添加到 Excel 文件:

  • C++
#include "Spire.Xls.o.h";

using namespace Spire::Xls;

int main()
{
    //初始化Workbook类的实例
    intrusive_ptr<Workbook> workbook = new Workbook();

    //获取特定的工作表
    intrusive_ptr<Worksheet> sheet = dynamic_pointer_cast<Worksheet>(workbook->GetWorksheets()->Get(0));

    //添加链接到网页的文本超链接
    intrusive_ptr<CellRange> cell1 = dynamic_pointer_cast<CellRange>(sheet->GetRange(L"B3"));
    intrusive_ptr<HyperLink> urlLink = sheet->GetHyperLinks()->Add(cell1);
    urlLink->SetType(HyperLinkType::Url);
    urlLink->SetTextToDisplay(L"链接到网站");
    urlLink->SetAddress(L"https://www.e-iceblue.cn/");

    //添加链接到电子邮件地址的文本超链接
    intrusive_ptr<CellRange> cell2 = dynamic_pointer_cast<CellRange>(sheet->GetRange(L"E3"));
    intrusive_ptr<HyperLink> mailLink = sheet->GetHyperLinks()->Add(cell2);
    mailLink->SetType(HyperLinkType::Url);
    mailLink->SetTextToDisplay(L"链接到邮件地址");
    mailLink->SetAddress(L"mailto:support @e-iceblue.com");

    //添加链接到外部文件的文本超链接
    intrusive_ptr<CellRange> cell3 = dynamic_pointer_cast<CellRange>(sheet->GetRange(L"B7"));
    intrusive_ptr<HyperLink> fileLink = sheet->GetHyperLinks()->Add(cell3);
    fileLink->SetType(HyperLinkType::File);
    fileLink->SetTextToDisplay(L"链接到外部文件");
    fileLink->SetAddress(L"C:\\Users\\Administrator\\Desktop\\2022年度报告.xlsx");

    //添加链接到工作簿文档指定工作表单元格的文本超链接
    intrusive_ptr<CellRange> cell4 = dynamic_pointer_cast<CellRange>(sheet->GetRange(L"E7"));
    intrusive_ptr<HyperLink> sheetLink = sheet->GetHyperLinks()->Add(cell4);
    sheetLink->SetType(HyperLinkType::Workbook);
    sheetLink->SetTextToDisplay(L"链接到工作簿文档的指定工作表单元格");
    sheetLink->SetAddress(L"Sheet2!B5");

    //添加链接到UNC地址的文本超链接
    intrusive_ptr<CellRange> cell5 = dynamic_pointer_cast<CellRange>(sheet->GetRange(L"B11"));
    intrusive_ptr<HyperLink> uncLink = sheet->GetHyperLinks()->Add(cell5);
    uncLink->SetType(HyperLinkType::Unc);
    uncLink->SetTextToDisplay(L"链接到UNC地址");
    uncLink->SetAddress(L"\\192.168.0.121");

    //自动调整列宽
    sheet->AutoFitColumn(2);
    sheet->AutoFitColumn(5);

    //保存结果文件
    workbook->SaveToFile(L"添加文本超链接.xlsx", ExcelVersion::Version2013);
    workbook->Dispose();
}

C++ 向 Excel 添加超链接

在 Excel 中添加图像超链接

与文本超链接类似,图像超链接是可以让您单击以导航到特定位置的图像。以下步骤说明了如何使用 Spire.XLS for C++ 将图像超链接添加到 Excel 文件:

  • C++
#include "Spire.Xls.o.h";

using namespace Spire::Xls;

int main()
{
    //初始化Workbook类的实例
    intrusive_ptr<Workbook> workbook = new Workbook();
    //获取特定的工作表
    intrusive_ptr<Worksheet> sheet = dynamic_pointer_cast<Worksheet>(workbook->GetWorksheets()->Get(0));

    //将文本添加到特定单元格
    sheet->GetRange(L"A1")->SetText(L"图像超链接");

    //将图像添加到特定单元格
    intrusive_ptr<ExcelPicture> picture = ExcelPicture::Dynamic_cast<ExcelPicture>(sheet->GetPictures()->Add(2, 1, L"Logo.png"));
    //设置图像宽度和高度
    picture->SetWidth(100);
    picture->SetHeight(100);

    //向图像添加超链接
    picture->SetHyperLink(L"https://www.e-iceblue.cn/", true);

    //设置列宽
    sheet->GetColumns()->GetItem(0)->SetColumnWidth(13);

    //保存结果文件
    workbook->SaveToFile(L"添加图像超链接.xlsx", ExcelVersion::Version2013);
    workbook->Dispose();
}

C++ 向 Excel 添加超链接

申请临时 License

如果您希望删除结果文档中的评估消息,或者摆脱功能限制,请该Email地址已收到反垃圾邮件插件保护。要显示它您需要在浏览器中启用JavaScript。获取有效期 30 天的临时许可证。

Spire.XLS 13.5.6 已发布。该版本新增实现chartsheet和worksheet之间可以互相移动位置的方法,并且新增了Worksheet.DeleteRows(int[] rows)方法来优化删除行的速度。同时,该版本还增强了 Excel 到 HTML 和图片的转换。许多已知问题也在该版本中被成功修复,如:修复了添加文本框时设置置于顶层功能不生效的问题。详情请阅读以下内容。

新功能:

问题修复:


下载 Spire.XLS 13.5.6请点击:

https://www.e-iceblue.cn/Downloads/Spire-XLS-NET.html

Spire.Doc 11.5.12 已发布。改版本增强了 Word 到 PDF 和 HTML 的转换。同时,该版本还修复了许多已知问题,如加载文档时抛异常"System.InvalidCastException"的问题。详情请阅读以下内容。

问题修复:


获取Spire.Doc 11.5.12请点击:

https://www.e-iceblue.cn/Downloads/Spire-Doc-NET.html

如果你想让段落更容易导航和阅读,将它们按字母、数字甚至项目符号顺序重新排列,读者可以快速找到他们想要的内容,并立即在列表中搜索。在本文中,您将学习如何使用 Spire.Doc for C++ 在 Word 文档中创建编号列表、项目符号列表和多级列表

安装 Spire.Doc for C++

有两种方法可以将 Spire.Doc for C++ 集成到您的应用程序中。一种方法是通过 NuGet 安装它,另一种方法是从我们的网站下载包并将库复制到您的程序中。通过 NuGet 安装更简单,更推荐使用。您可以通过访问以下链接找到更多详细信息。

如何将 Spire.Doc for C++ 集成到 C++ 程序中

在 Word 中创建编号列表

Spire.Doc for C++ 提供了 ListStyle 类,您可以使用该类创建编号列表样式或项目符号样式。然后,可以使用 Paragraph->GetListFormat()->ApplyStyle() 方法将列表样式应用于段落。创建编号列表的步骤如下。

  • C++
#include "Spire.Doc.o.h";

using namespace Spire::Doc;
using namespace std;

int main() {

    //创建一个Document对象
    intrusive_ptr<Document> document = new Document();

    //添加一个节
    intrusive_ptr<Section> section = document->AddSection();

    //创建编号列表样式
    intrusive_ptr<ListStyle> listStyle = new ListStyle(document, ListType::Numbered);
    listStyle->SetName(L"numberedList");
    listStyle->GetLevels()->GetItem(0)->SetPatternType(ListPatternType::DecimalEnclosedParen);
    listStyle->GetLevels()->GetItem(0)->SetTextPosition(20);
    document->GetListStyles()->Add(listStyle);

    //添加一个段落
    intrusive_ptr<Paragraph> paragraph = section->AddParagraph();
    paragraph->AppendText(L"必需的Web开发技能:");
    paragraph->GetFormat()->SetAfterSpacing(5);

    //添加段落并对其应用编号列表样式
    paragraph = section->AddParagraph();
    paragraph->AppendText(L"HTML");
    paragraph->GetListFormat()->ApplyStyle(L"numberedList");
    paragraph->GetListFormat()->SetListLevelNumber(0);

    //再添加四个段落,并将编号列表样式应用于特定段落
    paragraph = section->AddParagraph();
    paragraph->AppendText(L"CSS");
    paragraph->GetListFormat()->ApplyStyle(L"numberedList");
    paragraph->GetListFormat()->SetListLevelNumber(0);

    paragraph = section->AddParagraph();
    paragraph->AppendText(L"C++Script");
    paragraph->GetListFormat()->ApplyStyle(L"numberedList");
    paragraph->GetListFormat()->SetListLevelNumber(0);

    paragraph = section->AddParagraph();
    paragraph->AppendText(L"Python");
    paragraph->GetListFormat()->ApplyStyle(L"numberedList");
    paragraph->GetListFormat()->SetListLevelNumber(0);

    paragraph = section->AddParagraph();
    paragraph->AppendText(L"MySQL");
    paragraph->GetListFormat()->ApplyStyle(L"numberedList");
    paragraph->GetListFormat()->SetListLevelNumber(0);

    //将文档保存为Word文件
    document->SaveToFile(L"编号列表.docx", FileFormat::Docx2019);
    document->Dispose();
}

C++ 在 Word 文档中创建列表

在 Word 中创建项目符号列表

创建项目符号列表的过程与创建编号列表的过程类似。不同之处在于,创建列表样式时,必须将列表类型指定为“项目符号”,并为其设置项目符号。以下是详细步骤。

  • C++
#include "Spire.Doc.o.h";

using namespace Spire::Doc;
using namespace std;

int main() {

    //创建一个Document对象
    intrusive_ptr<Document> document = new Document();

    //添加一个节
    intrusive_ptr<Section> section = document->AddSection();

    //创建项目符号列表样式
    intrusive_ptr<ListStyle> listStyle = new ListStyle(document, ListType::Bulleted);
    listStyle->SetName(L"bulletedList");
    listStyle->GetLevels()->GetItem(0)->SetBulletCharacter(L"\u00B7");
    listStyle->GetLevels()->GetItem(0)->GetCharacterFormat()->SetFontName(L"Symbol");
    listStyle->GetLevels()->GetItem(0)->SetTextPosition(20);
    document->GetListStyles()->Add(listStyle);

    //添加一个段落
    intrusive_ptr<Paragraph> paragraph = section->AddParagraph();
    paragraph->AppendText(L"计算机科学科目:");
    paragraph->GetFormat()->SetAfterSpacing(5);

    //添加段落并对其应用项目符号列表样式
    paragraph = section->AddParagraph();
    paragraph->AppendText(L"数据结构");
    paragraph->GetListFormat()->ApplyStyle(L"bulletedList");
    paragraph->GetListFormat()->SetListLevelNumber(0);

    //再添加五个段落,并将项目符号列表样式应用于特定段落
    paragraph = section->AddParagraph();
    paragraph->AppendText(L"演算法");
    paragraph->GetListFormat()->ApplyStyle(L"bulletedList");
    paragraph->GetListFormat()->SetListLevelNumber(0);

    paragraph = section->AddParagraph();
    paragraph->AppendText(L"计算机网络");
    paragraph->GetListFormat()->ApplyStyle(L"bulletedList");
    paragraph->GetListFormat()->SetListLevelNumber(0);

    paragraph = section->AddParagraph();
    paragraph->AppendText(L"操作系统");
    paragraph->GetListFormat()->ApplyStyle(L"bulletedList");
    paragraph->GetListFormat()->SetListLevelNumber(0);

    paragraph = section->AddParagraph();
    paragraph->AppendText(L"C语言程序设计");
    paragraph->GetListFormat()->ApplyStyle(L"bulletedList");
    paragraph->GetListFormat()->SetListLevelNumber(0);

    paragraph = section->AddParagraph();
    paragraph->AppendText(L"计算理论");
    paragraph->GetListFormat()->ApplyStyle(L"bulletedList");
    paragraph->GetListFormat()->SetListLevelNumber(0);

    //保存结果文档
    document->SaveToFile(L"项目符号列表.docx", FileFormat::Docx2019);
    document->Dispose();
}

C++ 在 Word 文档中创建列表

在 Word 中创建多级编号列表

多级列表至少由两个不同的级别组成。嵌套列表的每个级别都可以使用 ListStyle->GetLevels()->GetItem(index) 方法进行访问。通过 ListLevel 对象,您可以设置某个级别的编号类型和前缀。以下是在 Word 中创建多级编号列表的步骤。

  • C++
#include "Spire.Doc.o.h";

using namespace Spire::Doc;
using namespace std;

int main() {

    //创建一个Document对象
    intrusive_ptr<Document> document = new Document();

    //添加一个节
    intrusive_ptr<Section> section = document->AddSection();

    //创建编号列表样式,指定每个级别的编号前缀和图案类型
    intrusive_ptr<ListStyle> listStyle = new ListStyle(document, ListType::Numbered);
    listStyle->SetName(L"nestedStyle");
    listStyle->GetLevels()->GetItem(0)->SetPatternType(ListPatternType::Arabic);
    listStyle->GetLevels()->GetItem(0)->SetTextPosition(20);
    listStyle->GetLevels()->GetItem(1)->SetNumberPrefix(L"%1.");
    listStyle->GetLevels()->GetItem(1)->SetPatternType(ListPatternType::Arabic);
    listStyle->GetLevels()->GetItem(2)->SetNumberPrefix(L"%1.%2.");
    listStyle->GetLevels()->GetItem(2)->SetPatternType(ListPatternType::Arabic);
    document->GetListStyles()->Add(listStyle);

    //添加一个段落
    intrusive_ptr<Paragraph> paragraph = section->AddParagraph();
    paragraph->AppendText(L"这是一个多级编号列表:");
    paragraph->GetFormat()->SetAfterSpacing(5);

    //添加段落并对其应用编号列表样式
    paragraph = section->AddParagraph();
    paragraph->AppendText(L"第一项");
    paragraph->GetListFormat()->ApplyStyle(L"nestedStyle");
    paragraph->GetListFormat()->SetListLevelNumber(0);

    //再添加五个段落,并将编号列表样式应用于特定段落
    paragraph = section->AddParagraph();
    paragraph->AppendText(L"第二项");
    paragraph->GetListFormat()->ApplyStyle(L"nestedStyle");
    paragraph->GetListFormat()->SetListLevelNumber(0);

    paragraph = section->AddParagraph();
    paragraph->AppendText(L"第一个子项");
    paragraph->GetListFormat()->ApplyStyle(L"nestedStyle");
    paragraph->GetListFormat()->SetListLevelNumber(1);

    paragraph = section->AddParagraph();
    paragraph->AppendText(L"第二个子项");
    paragraph->GetListFormat()->ContinueListNumbering();
    paragraph->GetListFormat()->ApplyStyle(L"nestedStyle");

    paragraph = section->AddParagraph();
    paragraph->AppendText(L"一个子项");
    paragraph->GetListFormat()->ApplyStyle(L"nestedStyle");
    paragraph->GetListFormat()->SetListLevelNumber(2);

    paragraph = section->AddParagraph();
    paragraph->AppendText(L"第三项");
    paragraph->GetListFormat()->ApplyStyle(L"nestedStyle");
    paragraph->GetListFormat()->SetListLevelNumber(0);

    //保存结果文档
    document->SaveToFile(L"多级编号列表.docx", FileFormat::Docx2019);
    document->Dispose();
}

C++ 在 Word 文档中创建列表

在 Word 中创建多级混合类型列表

多级列表可以是编号列表和项目符号列表的组合。要创建混合类型列表,只需要创建编号列表样式和项目符号列表样式,并将它们应用于不同的段落。具体步骤如下。

  • C++
#include "Spire.Doc.o.h";

using namespace Spire::Doc;
using namespace std;

int main() {

    //创建一个Document对象
    intrusive_ptr<Document> document = new Document();

    //添加一个节
    intrusive_ptr<Section> section = document->AddSection();

    //创建编号列表样式
    intrusive_ptr<ListStyle> numberedListStyle = new ListStyle(document, ListType::Numbered);
    numberedListStyle->SetName(L"numberedStyle");
    numberedListStyle->GetLevels()->GetItem(0)->SetPatternType(ListPatternType::Arabic);
    numberedListStyle->GetLevels()->GetItem(0)->SetTextPosition(20);
    numberedListStyle->GetLevels()->GetItem(1)->SetPatternType(ListPatternType::LowLetter);
    document->GetListStyles()->Add(numberedListStyle);

    //创建项目符号列表样式
    intrusive_ptr<ListStyle> bulletedListStyle = new ListStyle(document, ListType::Bulleted);
    bulletedListStyle->SetName(L"bulletedStyle");
    bulletedListStyle->GetLevels()->GetItem(2)->SetBulletCharacter(L"\u002A");
    bulletedListStyle->GetLevels()->GetItem(2)->GetCharacterFormat()->SetFontName(L"Symbol");
    document->GetListStyles()->Add(bulletedListStyle);

    //添加段落
    intrusive_ptr<Paragraph> paragraph = section->AddParagraph();
    paragraph->AppendText(L"这是一个多级混合列表:");
    paragraph->GetFormat()->SetAfterSpacing(5);

    //添加段落并对其应用编号列表样式
    paragraph = section->AddParagraph();
    paragraph->AppendText(L"第一项");
    paragraph->GetListFormat()->ApplyStyle(L"numberedStyle");
    paragraph->GetListFormat()->SetListLevelNumber(0);

    //再添加五个段落,并对其应用不同的列表样式
    paragraph = section->AddParagraph();
    paragraph->AppendText(L"第一个子项");
    paragraph->GetListFormat()->ApplyStyle(L"numberedStyle");
    paragraph->GetListFormat()->SetListLevelNumber(1);

    paragraph = section->AddParagraph();
    paragraph->AppendText(L"第二个子项");
    paragraph->GetListFormat()->SetListLevelNumber(1);
    paragraph->GetListFormat()->ApplyStyle(L"numberedStyle");

    paragraph = section->AddParagraph();
    paragraph->AppendText(L"子项1");
    paragraph->GetListFormat()->ApplyStyle(L"bulletedStyle");
    paragraph->GetListFormat()->SetListLevelNumber(2);

    paragraph = section->AddParagraph();
    paragraph->AppendText(L"子项2");
    paragraph->GetListFormat()->ApplyStyle(L"bulletedStyle");
    paragraph->GetListFormat()->SetListLevelNumber(2);

    paragraph = section->AddParagraph();
    paragraph->AppendText(L"第二项");
    paragraph->GetListFormat()->ApplyStyle(L"numberedStyle");
    paragraph->GetListFormat()->SetListLevelNumber(0);

    //保存结果文档
    document->SaveToFile(L"多级混合类型列表.docx", FileFormat::Docx);
    document->Dispose();
}

C++ 在 Word 文档中创建列表

申请临时 License

如果您希望删除结果文档中的评估消息,或者摆脱功能限制,请该Email地址已收到反垃圾邮件插件保护。要显示它您需要在浏览器中启用JavaScript。获取有效期 30 天的临时许可证。

创建或编辑 Excel 文件时,用户可能需要操作工作表以使文件符合其特定需求。例如,他们可能需要添加新的工作表来记录不同类别的数据,移动或重新排列工作表以确保数据按逻辑顺序显示,或者删除包含不必要信息或错误的工作表。在本文中,我们将阐述如何使用 Spire.XLS for C++ 在 Excel 中添加、移动或删除工作表

安装 Spire.XLS for C++

有两种方法可以将 Spire.XLS for C++ 集成到您的应用程序中。一种方法是通过 NuGet 安装它,另一种方法是从我们的网站下载包并将库复制到您的程序中。通过 NuGet 安装更简单,更推荐使用。您可以通过访问以下链接找到更多详细信息。

如何将 Spire.XLS for C++ 集成到 C++ 程序中

将工作表添加到 Excel 文件

您可以使用 Workbook->GetWorksheets()->Add(LPCWSTR_S name) 方法将新工作表添加到 Excel 文件中。具体步骤如下:

  • C++
#include "Spire.Xls.o.h";

using namespace Spire::Xls;

int main()
{
	//初始化Workbook类的实例
	intrusive_ptr<Workbook> workbook = new Workbook();
	//加载Excel文件
	workbook->LoadFromFile(L"示例文档.xlsx");

	//将具有特定名称的新工作表添加到文件中
	intrusive_ptr<Worksheet> sheet = dynamic_pointer_cast<Worksheet>(workbook->GetWorksheets()->Add(L"新工作表"));
	//将文本添加到工作表
	dynamic_pointer_cast<CellRange>(sheet->GetRange(L"B1"))->SetText(L"这是一个新的工作表。");
	//自动调整第二列的宽度
	sheet->AutoFitColumn(2);

	//保存结果文件
	workbook->SaveToFile(L"添加工作表.xlsx", ExcelVersion::Version2013);
	workbook->Dispose();
}

C++ 在 Excel 中添加、移动或删除工作表

将工作表移动到 Excel 文件中的另一个位置

Spire.XLS for C++ 提供了 XlsWorksheet->MoveWorksheet(int destIndex) 方法,该方法可以让您轻松地将工作表从 Excel 文件中的一个位置移动到另一个位置。具体步骤如下:

  • C++
#include "Spire.Xls.o.h";

using namespace Spire::Xls;

int main()
{
	//初始化Workbook类的实例
	intrusive_ptr<Workbook> workbook = new Workbook();
	//加载Excel文件
	workbook->LoadFromFile(L"添加工作表.xlsx");

	//获取需要移动的工作表
	intrusive_ptr<Worksheet> sheet = dynamic_pointer_cast<Worksheet>(workbook->GetWorksheets()->Get(1));

	//将工作表移动到Excel文件中的第一个位置
	sheet->MoveWorksheet(0);

	//保存结果文档
	workbook->SaveToFile(L"移动工作表.xlsx", ExcelVersion::Version2013);
	workbook->Dispose();
}

C++ 在 Excel 中添加、移动或删除工作表

从 Excel 文件中删除工作表

从 Excel 文件中删除工作表也很简单,只需调用 Workbook->GetWorksheets()->RemoveAt(int index) 方法即可。具体步骤如下:

  • C++
#include "Spire.Xls.o.h";

using namespace Spire::Xls;

int main()
{
	//初始化Workbook类的实例
	intrusive_ptr<Workbook> workbook = new Workbook();
	//加载Excel文件
	workbook->LoadFromFile(L"添加工作表.xlsx");

	//使用工作表索引从Excel文件中删除第二个工作表
	workbook->GetWorksheets()->RemoveAt(1);

	//保存结果文档
	workbook->SaveToFile(L"删除工作表.xlsx", ExcelVersion::Version2013);
	workbook->Dispose();
}

C++ 在 Excel 中添加、移动或删除工作表

申请临时 License

如果您希望删除结果文档中的评估消息,或者摆脱功能限制,请该Email地址已收到反垃圾邮件插件保护。要显示它您需要在浏览器中启用JavaScript。获取有效期 30 天的临时许可证。

Spire.Office for Java 8.5.6 已发布。在该版本中,Spire.Doc for Java增强了 Word 到 PDF 和Word 到OFD的转换;Spire.PDF for Java支持了判断 PDF 流文档是否被加密的功能;Spire.XLS for Java增强了 Excel 到 PDF 的转换;Spire.Presentation for Java增强了 PPT 到图片的转换功能。此外,许多已知问题也在该版本中被成功修复。详情请阅读以下内容。

获取 Spire.Office for Java 8.5.6请点击:

https://www.e-iceblue.cn/Downloads/Spire-Office-JAVA.html


Spire.Doc for Java

问题修复:


Spire.PDF for Java

新功能:

问题修复:


Spire.XLS for Java

问题修复:


Spire. Presentation for Java

问题修复:

Spire.Presentation for Java 8.5.2 已发布。本次更新增强了 PPT 到图片的转换功能。此外,该版本还修复了一些已知问题,如获取文字的光晕颜色失败的问题。详情请阅读以下内容。

问题修复:


获取Spire.Presentation for Java 8.5.2请点击:

https://www.e-iceblue.cn/Downloads/Spire-Presentation-JAVA.html