qax-os / excelize

Go language library for reading and writing Microsoft Excel™ (XLAM / XLSM / XLSX / XLTM / XLTX) spreadsheets
https://xuri.me/excelize
BSD 3-Clause "New" or "Revised" License
18.43k stars 1.73k forks source link

Rename SetLegacyDrawingHF to AddHeaderFooterImage #2023

Closed imirkin closed 2 weeks ago

imirkin commented 3 weeks ago

Question: should HeaderFooterGraphics be renamed to something, or OK as-is?

PR Details

Rename SetLegacyDrawingHF to SetHeaderFooterImage.

Motivation and Context

This is being done per request from @xuri. Probably fits in better with the overall naming convention.

How Has This Been Tested

go test passes. Given that this was generated with sed -i, no further testing has been done.

Types of changes

Checklist

codecov[bot] commented 3 weeks ago

Codecov Report

All modified and coverable lines are covered by tests :white_check_mark:

Project coverage is 99.20%. Comparing base (b7375bc) to head (8e79403). Report is 2 commits behind head on master.

Additional details and impacted files ```diff @@ Coverage Diff @@ ## master #2023 +/- ## ======================================= Coverage 99.20% 99.20% ======================================= Files 32 32 Lines 29880 29947 +67 ======================================= + Hits 29642 29709 +67 Misses 158 158 Partials 80 80 ``` | [Flag](https://app.codecov.io/gh/qax-os/excelize/pull/2023/flags?src=pr&el=flags&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=qax-os) | Coverage Δ | | |---|---|---| | [unittests](https://app.codecov.io/gh/qax-os/excelize/pull/2023/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=qax-os) | `99.20% <100.00%> (+<0.01%)` | :arrow_up: | Flags with carried forward coverage won't be shown. [Click here](https://docs.codecov.io/docs/carryforward-flags?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=qax-os#carryforward-flags-in-the-pull-request-comment) to find out more.

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.

imirkin commented 3 weeks ago

BTW, it looks like it may be possible to set multiple images somehow:

https://github.com/jmcnamara/XlsxWriter/blob/main/xlsxwriter/worksheet.py#L4244

Perhaps multiple shapes in the VML? No idea, I wasn't able to follow this code. I don't need this myself, but perhaps an improvement for later.

xuri commented 3 weeks ago

The name HeaderFooterGraphics is fine, but I think we need to add new Position field in this data type, acceptable value is LH, CH, RH, LF, CF, RF, LHFIRST, CHFIRST, RHFIRST, LFFIRST, CFFIRST, RFFIRST for add multiple shapes in the VML. I will tried to update based on this PR in some time.

imirkin commented 3 weeks ago

Well there's still only one drawing allowed, so probably have to set them all at once. Otherwise you have to edit the vml.

xuri commented 3 weeks ago

Yep, support append VML shapes (just like form controls) to allow call SetHeaderFooterImage multiple times, that's would be better.