jmcnamara / libxlsxwriter

A C library for creating Excel XLSX files.
https://libxlsxwriter.github.io
Other
1.48k stars 330 forks source link

Add signature file for VBA projects #412

Closed HolgiHo closed 11 months ago

HolgiHo commented 11 months ago

PR for issue #411.

Library changes:

Tests:

Examples:

Utilities for testing the VBA project is signed correctly:

HolgiHo commented 11 months ago

Will open another PR with some fixes.

jmcnamara commented 11 months ago

Thanks for that. It was only requested once but I think it is a useful feature. Some comments.

  • workbook: new API function workbook_add_vba_project_signature

I think a better function name would be workbook_add_signed_vba_project_signature(lxw_workbook *self, const char *vba_project, const char *signature).

It could call workbook_add_vba_project() internally to add the vba macros/project.

packager: copy vbaProjectSignature.bin, create vbaProject.bin.rels

Ok.

new functional test test_macro_signed

Good. But you could just call it test_macro04.

add examples/macro_signed.c

You can omit the example. It isn't common enough or complicated enough to need one.

fix examples/vbaProject.bin: Was corrupted; now the button press works again;

I haven't had any report that it is corrupted and I just tested it again and it seems to work fine. So you can omit this change (or figure out if it is a Windows issue).

Utilities for testing the VBA project is signed correctly:

Ok.

I'll make other comments inline if needed.

HolgiHo commented 11 months ago

I think a better function name would be workbook_add_signed_vba_project_signature(lxw_workbook *self, const char *vba_project, const char *signature).

Do you mean workbook_add_signed_vba_project (without "signature)?

It could call workbook_add_vba_project() internally to add the vba macros/project.

Ok.

fix examples/vbaProject.bin: Was corrupted; now the button press works again; I will double-check.

Please check out PR #415 as I have fixed the git commit message there.