功能: 服务端生成完整报告并保护单任务

- 使用 libxlsxwriter 常量内存导出 Excel\n- 增加全局任务占用提示与原始数据持久化\n- 保留运行时任务数据并更新接口文档
This commit is contained in:
cloud
2026-08-05 16:47:31 +08:00
parent 07274797af
commit 99ed321d24
2292 changed files with 134317 additions and 126 deletions
+8
View File
@@ -0,0 +1,8 @@
###############################################################################
#
# Makefile for libxlsxwriter library.
#
# Copyright 2014-2022, John McNamara, jmcnamara@cpan.org
#
include ../Makefile.unit
+15
View File
@@ -0,0 +1,15 @@
/*
* Test runner for xmlwriter using ctest.
*
* Copyright 2014-2022, John McNamara, jmcnamara@cpan.org
*
*/
#define CTEST_MAIN
#include "../ctest.h"
int main(int argc, const char *argv[])
{
return ctest_main(argc, argv);
}
+168
View File
@@ -0,0 +1,168 @@
/*
* Tests for the lib_xlsx_writer library.
*
* Copyright 2014-2022, John McNamara, jmcnamara@cpan.org
*
*/
#include "../ctest.h"
#include "../helper.h"
#include "../../../include/xlsxwriter/app.h"
// Test assembling a complete App file.
CTEST(app, app01) {
char* got;
char exp[] =
"<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?>\n"
"<Properties xmlns=\"http://schemas.openxmlformats.org/officeDocument/2006/extended-properties\" xmlns:vt=\"http://schemas.openxmlformats.org/officeDocument/2006/docPropsVTypes\">"
"<Application>Microsoft Excel</Application>"
"<DocSecurity>0</DocSecurity>"
"<ScaleCrop>false</ScaleCrop>"
"<HeadingPairs>"
"<vt:vector size=\"2\" baseType=\"variant\">"
"<vt:variant>"
"<vt:lpstr>Worksheets</vt:lpstr>"
"</vt:variant>"
"<vt:variant>"
"<vt:i4>1</vt:i4>"
"</vt:variant>"
"</vt:vector>"
"</HeadingPairs>"
"<TitlesOfParts>"
"<vt:vector size=\"1\" baseType=\"lpstr\">"
"<vt:lpstr>Sheet1</vt:lpstr>"
"</vt:vector>"
"</TitlesOfParts>"
"<Company>"
"</Company>"
"<LinksUpToDate>false</LinksUpToDate>"
"<SharedDoc>false</SharedDoc>"
"<HyperlinksChanged>false</HyperlinksChanged>"
"<AppVersion>12.0000</AppVersion>"
"</Properties>";
FILE* testfile = lxw_tmpfile(NULL);
lxw_app *app = lxw_app_new();
app->file = testfile;
lxw_app_add_part_name(app,"Sheet1");
lxw_app_add_heading_pair(app, "Worksheets", "1");
lxw_app_assemble_xml_file(app);
RUN_XLSX_STREQ_SHORT(exp, got);
lxw_app_free(app);
}
// Test assembling a complete App file.
CTEST(app, app02) {
char* got;
char exp[] =
"<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?>\n"
"<Properties xmlns=\"http://schemas.openxmlformats.org/officeDocument/2006/extended-properties\" xmlns:vt=\"http://schemas.openxmlformats.org/officeDocument/2006/docPropsVTypes\">"
"<Application>Microsoft Excel</Application>"
"<DocSecurity>0</DocSecurity>"
"<ScaleCrop>false</ScaleCrop>"
"<HeadingPairs>"
"<vt:vector size=\"2\" baseType=\"variant\">"
"<vt:variant>"
"<vt:lpstr>Worksheets</vt:lpstr>"
"</vt:variant>"
"<vt:variant>"
"<vt:i4>2</vt:i4>"
"</vt:variant>"
"</vt:vector>"
"</HeadingPairs>"
"<TitlesOfParts>"
"<vt:vector size=\"2\" baseType=\"lpstr\">"
"<vt:lpstr>Sheet1</vt:lpstr>"
"<vt:lpstr>Sheet2</vt:lpstr>"
"</vt:vector>"
"</TitlesOfParts>"
"<Company>"
"</Company>"
"<LinksUpToDate>false</LinksUpToDate>"
"<SharedDoc>false</SharedDoc>"
"<HyperlinksChanged>false</HyperlinksChanged>"
"<AppVersion>12.0000</AppVersion>"
"</Properties>";
FILE* testfile = lxw_tmpfile(NULL);
lxw_app *app = lxw_app_new();
app->file = testfile;
lxw_app_add_part_name(app,"Sheet1");
lxw_app_add_part_name(app,"Sheet2");
lxw_app_add_heading_pair(app, "Worksheets", "2");
lxw_app_assemble_xml_file(app);
RUN_XLSX_STREQ_SHORT(exp, got);
lxw_app_free(app);
}
// Test assembling a complete App file.
CTEST(app, app03) {
char* got;
char exp[] =
"<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?>\n"
"<Properties xmlns=\"http://schemas.openxmlformats.org/officeDocument/2006/extended-properties\" xmlns:vt=\"http://schemas.openxmlformats.org/officeDocument/2006/docPropsVTypes\">"
"<Application>Microsoft Excel</Application>"
"<DocSecurity>0</DocSecurity>"
"<ScaleCrop>false</ScaleCrop>"
"<HeadingPairs>"
"<vt:vector size=\"4\" baseType=\"variant\">"
"<vt:variant>"
"<vt:lpstr>Worksheets</vt:lpstr>"
"</vt:variant>"
"<vt:variant>"
"<vt:i4>1</vt:i4>"
"</vt:variant>"
"<vt:variant>"
"<vt:lpstr>Named Ranges</vt:lpstr>"
"</vt:variant>"
"<vt:variant>"
"<vt:i4>1</vt:i4>"
"</vt:variant>"
"</vt:vector>"
"</HeadingPairs>"
"<TitlesOfParts>"
"<vt:vector size=\"2\" baseType=\"lpstr\">"
"<vt:lpstr>Sheet1</vt:lpstr>"
"<vt:lpstr>Sheet1!Print_Titles</vt:lpstr>"
"</vt:vector>"
"</TitlesOfParts>"
"<Company>"
"</Company>"
"<LinksUpToDate>false</LinksUpToDate>"
"<SharedDoc>false</SharedDoc>"
"<HyperlinksChanged>false</HyperlinksChanged>"
"<AppVersion>12.0000</AppVersion>"
"</Properties>";
FILE* testfile = lxw_tmpfile(NULL);
lxw_app *app = lxw_app_new();
app->file = testfile;
lxw_app_add_part_name(app,"Sheet1");
lxw_app_add_part_name(app,"Sheet1!Print_Titles");
lxw_app_add_heading_pair(app, "Worksheets", "1");
lxw_app_add_heading_pair(app, "Named Ranges", "1");
lxw_app_assemble_xml_file(app);
RUN_XLSX_STREQ_SHORT(exp, got);
lxw_app_free(app);
}
@@ -0,0 +1,28 @@
/*
* Tests for the libxlsxwriter library.
*
* Copyright 2014-2022, John McNamara, jmcnamara@cpan.org
*
*/
#include "../ctest.h"
#include "../helper.h"
#include "../../../include/xlsxwriter/app.h"
// Test _xml_declaration().
CTEST(app, xml_declaration) {
char* got;
char exp[] = "<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?>\n";
FILE* testfile = lxw_tmpfile(NULL);
lxw_app *app = lxw_app_new();
app->file = testfile;
_app_xml_declaration(app);
RUN_XLSX_STREQ(exp, got);
lxw_app_free(app);
}