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

Kkazala/exportformatting #1208

Merged
merged 6 commits into from
Jul 13, 2022
Merged

Kkazala/exportformatting #1208

merged 6 commits into from
Jul 13, 2022

Conversation

kkazala
Copy link

@kkazala kkazala commented Jul 5, 2022

@dfinke Would you be interested in one new, and one updated example?
I updated the Highlight-DiffCells.ps1 to format both compared cells, and the whole row:
image

And I added an example (GetConditionalFormatting.ps1) that exports conditional formatting rules in a "ready to use" format, so if someone has better grasp on Excel than the Add-ConditionalFormatting, they won't need to open an issue with you
image

And a question: would you consider mentioning the examples on https://github.com/dfinke/ImportExcel? I'm a bit ashamed to admit, but I had no idea they are there until you asked me to contribute 🙈

@dfinke
Copy link
Owner

dfinke commented Jul 7, 2022

@kkazala Thank you for the PR and suggestion about adding the examples to the readme.

Is it possible, I like the GetConditionalFormatting.ps1, two things.

  1. Re-work that as a function Get-ConditionalFormatting in the ps1 you have
  2. Add a an xlsx so when I run your cool ps1, I can see this in action.

I may add this to this to the core library.

Thanks again.

@kkazala
Copy link
Author

kkazala commented Jul 7, 2022

@dfinke cool, will do

And... you just gave me an idea. Would you consider, instead of an example, adding an exportFormatting function?
I only had problem with a formatting color, since Excel is using theme numbers and not colors

If you still would like it to be an example, could you suggest a folder the excel? I don't want to disorganize the project:)

@dfinke
Copy link
Owner

dfinke commented Jul 7, 2022

Thanks. I like the idea of an export formatting function. I usually create examples and so I can try before I promote it to the core. That way it fleshes out issues, edge cases etc. Helps for writing unit tests.

For the excel file for the example? You can put it next to the example ps1 file. If I understand your question.

@kkazala
Copy link
Author

kkazala commented Jul 11, 2022

@dfinke I added the Excel as requested, the file name is GetConditionalFormatting.xlsx to make sure the excel and the script are next to each other

Please let me know if there's anything else

@dfinke
Copy link
Owner

dfinke commented Jul 12, 2022

Please double check this line. The $worksheetName is blank when it prints. Plus, don't need the Write-Host.

I like the idea behind this. Dump Excel constructs as PowerShell code.

Write-Host "Add-ConditionalFormatting -Worksheet `$excel[""$worksheetName""]  -Range '$($_.Address)'  -ConditionValue '$($_.Formula)' -RuleType $($_.Type) "

@kkazala
Copy link
Author

kkazala commented Jul 13, 2022

@dfinke Sorry about that, I was a bit in a rush. Fixed now.

@dfinke dfinke merged commit 513ff59 into dfinke:master Jul 13, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants