Add fix for worksheets with tables and background images.

This commit is contained in:
John McNamara 2023-01-31 23:32:05 +00:00
parent 800a108057
commit 93616e2729
6 changed files with 59 additions and 5 deletions

View File

@ -1440,16 +1440,16 @@ _write_worksheet_rels_file(lxw_packager *self)
lxw_add_worksheet_relationship(rels, rel->type, rel->target,
rel->target_mode);
STAILQ_FOREACH(rel, worksheet->external_table_links, list_pointers) {
lxw_add_worksheet_relationship(rels, rel->type, rel->target,
rel->target_mode);
}
rel = worksheet->external_background_link;
if (rel)
lxw_add_worksheet_relationship(rels, rel->type, rel->target,
rel->target_mode);
STAILQ_FOREACH(rel, worksheet->external_table_links, list_pointers) {
lxw_add_worksheet_relationship(rels, rel->type, rel->target,
rel->target_mode);
}
rel = worksheet->external_comment_link;
if (rel)
lxw_add_worksheet_relationship(rels, rel->type, rel->target,

View File

@ -0,0 +1,24 @@
/*****************************************************************************
* Test cases for libxlsxwriter.
*
* Test to compare output against Excel files.
*
* Copyright 2014-2023, John McNamara, jmcnamara@cpan.org
*
*/
#include "xlsxwriter.h"
int main() {
lxw_workbook *workbook = workbook_new("test_table29.xlsx");
lxw_worksheet *worksheet = workbook_add_worksheet(workbook, NULL);
worksheet_set_column(worksheet, COLS("C:F"), 10.288, NULL);
worksheet_add_table(worksheet, RANGE("C3:F13"), NULL);
worksheet_insert_image(worksheet, 0, 0, "images/red.png");
return workbook_close(workbook);
}

View File

@ -0,0 +1,24 @@
/*****************************************************************************
* Test cases for libxlsxwriter.
*
* Test to compare output against Excel files.
*
* Copyright 2014-2023, John McNamara, jmcnamara@cpan.org
*
*/
#include "xlsxwriter.h"
int main() {
lxw_workbook *workbook = workbook_new("test_table30.xlsx");
lxw_worksheet *worksheet = workbook_add_worksheet(workbook, NULL);
worksheet_set_column(worksheet, COLS("C:F"), 10.288, NULL);
worksheet_add_table(worksheet, RANGE("C3:F13"), NULL);
worksheet_set_background(worksheet, "images/logo.jpg");
return workbook_close(workbook);
}

View File

@ -104,3 +104,9 @@ class TestCompareXLSXFiles(base_test_class.XLSXBaseTest):
def test_table26(self):
self.run_exe_test('test_table26')
def test_table29(self):
self.run_exe_test('test_table29')
def test_table30(self):
self.run_exe_test('test_table30')

Binary file not shown.

Binary file not shown.