Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

#1296 add GetRowOpts to Rows #1297

Merged
merged 1 commit into from Aug 10, 2022

Conversation

thomascharbonnel
Copy link
Contributor

@thomascharbonnel thomascharbonnel commented Aug 1, 2022

Signed-off-by: Thomas Charbonnel github@charbonnel.email

PR Details

This PR fixes #1296 and adds a method called GetStyleID on struct Rows{} in order to get access to a row's style ID while stream-reading rows inside an XLSX file.

Description

  • Add styleID property to Rows{}
  • Set row's style in rows.Next()
  • Provide getter rows.GetStyleID
  • Create relevant test

Related Issue

#1296

Motivation and Context

This PR adds the ability to read a row's style, which wasn't present before.

How Has This Been Tested

Test fixture file Book1.xlsx was updated to add a row style on the first row of Sheet2. The test makes sure GetStyleID returns the right ID.

Types of changes

  • Docs change / refactoring / dependency upgrade
  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)

Checklist

  • My code follows the code style of this project.
  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.
  • I have read the CONTRIBUTING document.
  • I have added tests to cover my changes.
  • All new and existing tests passed.

@thomascharbonnel thomascharbonnel marked this pull request as ready for review August 1, 2022 08:45
@codecov-commenter
Copy link

codecov-commenter commented Aug 1, 2022

Codecov Report

Merging #1297 (156cb4a) into master (b8ceaf7) will increase coverage by 0.00%.
The diff coverage is 100.00%.

@@           Coverage Diff           @@
##           master    #1297   +/-   ##
=======================================
  Coverage   98.47%   98.47%           
=======================================
  Files          31       31           
  Lines       23448    23482   +34     
=======================================
+ Hits        23090    23124   +34     
  Misses        239      239           
  Partials      119      119           
Flag Coverage Δ
unittests 98.47% <100.00%> (+<0.01%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
rows.go 97.39% <100.00%> (+0.09%) ⬆️
sheet.go 100.00% <100.00%> (ø)

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

@thomascharbonnel
Copy link
Contributor Author

On second thought, it might be better to return a RowOpt struct instead

Copy link
Member

@xuri xuri left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for your PR, I've left some comments.

rows.go Outdated Show resolved Hide resolved
@xuri xuri added the size/S Denotes a PR that changes 10-29 lines, ignoring generated files. label Aug 2, 2022
rows.go Outdated Show resolved Hide resolved
@thomascharbonnel thomascharbonnel force-pushed the 1296-styleid-rows-streamread branch 2 times, most recently from 2f00f5a to c8e5b9c Compare August 4, 2022 03:13
@thomascharbonnel
Copy link
Contributor Author

I've updated the PR to return RowOpts instead.
I haven't changed styleid to uint because that would mean changing excelize.NewStyle too

Copy link
Member

@xuri xuri left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for your update. I've left some comments.

rows.go Outdated Show resolved Hide resolved
rows.go Outdated Show resolved Hide resolved
rows.go Show resolved Hide resolved
sheet.go Outdated Show resolved Hide resolved
@thomascharbonnel thomascharbonnel marked this pull request as draft August 5, 2022 02:40
@thomascharbonnel

This comment was marked as resolved.

rows_test.go Show resolved Hide resolved
@xuri xuri added size/M Denotes a PR that changes 30-99 lines, ignoring generated files. and removed size/S Denotes a PR that changes 10-29 lines, ignoring generated files. labels Aug 8, 2022
@thomascharbonnel thomascharbonnel changed the title #1296 add GetStyleID to Rows #1296 add GetRowOpts to Rows Aug 9, 2022
@thomascharbonnel thomascharbonnel marked this pull request as ready for review August 9, 2022 03:33
Copy link
Member

@xuri xuri left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for your update. In addition, I suggest adding some unit tests.

sheet.go Show resolved Hide resolved
@thomascharbonnel thomascharbonnel force-pushed the 1296-styleid-rows-streamread branch 2 times, most recently from f0d0905 to f61e6bd Compare August 10, 2022 02:38
Signed-off-by: Thomas Charbonnel <github@charbonnel.email>
@xuri xuri added size/L Denotes a PR that changes 100-499 lines, ignoring generated files. and removed size/M Denotes a PR that changes 30-99 lines, ignoring generated files. labels Aug 10, 2022
@xuri xuri merged commit ed91cdd into qax-os:master Aug 10, 2022
@xuri
Copy link
Member

xuri commented Aug 10, 2022

LGTM, thanks for your great work.

@xuri xuri added this to Feature in v2.6.1 Aug 10, 2022
xuri pushed a commit to carbin-gun/excelize that referenced this pull request Oct 9, 2022
…der (qax-os#1297)

- Support get rows properties by `GetRowOpts` function
- New exported constant `MaxCellStyles`
xuri pushed a commit to JDavidVR/excelize that referenced this pull request Jul 11, 2023
…der (qax-os#1297)

- Support get rows properties by `GetRowOpts` function
- New exported constant `MaxCellStyles`
jenbonzhang pushed a commit to jenbonzhang/excelize that referenced this pull request Oct 22, 2023
…der (qax-os#1297)

- Support get rows properties by `GetRowOpts` function
- New exported constant `MaxCellStyles`
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
size/L Denotes a PR that changes 100-499 lines, ignoring generated files.
Projects
No open projects
v2.6.1
Feature
Development

Successfully merging this pull request may close these issues.

StreamReader (Rows) should provide access to Row style
3 participants