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

Add support for setting SheetView.showGridLines #145

Closed
dolmen opened this issue Nov 3, 2017 · 2 comments
Closed

Add support for setting SheetView.showGridLines #145

dolmen opened this issue Nov 3, 2017 · 2 comments
Labels
enhancement New feature or request

Comments

@dolmen
Copy link
Contributor

dolmen commented Nov 3, 2017

showGridLines allows to disable the display of the grid.

I propose to add a method SetSheetShowGridLines(string, bool).

I will work on a patch to implement it.

@xuri xuri added the enhancement New feature or request label Nov 4, 2017
@dolmen
Copy link
Contributor Author

dolmen commented Nov 8, 2017

I choose to implement it in another way to avoid polluting the namespace with functions for each view option:

  • a method SetSheetViewOptions(name string, viewIndex int, opts ...SheetViewOption) error
  • types for each option that implement the SheetViewOption interface

Here is the work in progress implementing 2 options (ShowGridLines and ShowRowColHeaders): dolmen-go/excelize@ec12eaf

@xuri If this style is ok I will fully implement all options and maybe add the mirror GetSheetViewOptions.

@dolmen
Copy link
Contributor Author

dolmen commented Nov 8, 2017

Work in progress update, implementing more options (DefaultGridColor, RightToLeft, ShowFormulas) and method GetSheetViewOptions: a4ffb4f...dolmen-go:feature/SheetView-options

dolmen added a commit to dolmen-go/excelize that referenced this issue Nov 16, 2017
Two new methods:
- SetSheetViewOptions(sheetName string, viewIndex int, opts ...SheetViewOption) error
- GetSheetViewOptions(sheetName string, viewIndex int, opts ...SheetViewOptionPtr) error

The option values are given by the user through types that have privates methods
that implement the private SheetViewOption and SheetViewOptionPtr interfaces:
- DefaultGridColor(bool)
- RightToLeft(bool)
- ShowFormulas(bool)
- ShowGridLines(bool)
- ShowRowColHeaders(bool)

Examples:
    err := xl.SetSheetViewOptions("Sheet1", -1, excelize.ShowGridLines(true))

    var showGridLines excelize.ShowGridLines
    err := xl.GetSheetViewOptions("Sheet1", -1, &showGridLines)

Fixes qax-os#145.
@xuri xuri closed this as completed in 88e48e0 Nov 17, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants