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

use "auto" for setRowheights #367

Closed
David-Rattray opened this issue Jul 18, 2022 · 16 comments
Closed

use "auto" for setRowheights #367

David-Rattray opened this issue Jul 18, 2022 · 16 comments
Labels

Comments

@David-Rattray
Copy link
Contributor

Hello,

It seems like it was already done at one point, but is not present in the current version of openxlsx.
awalker89/openxlsx#382

This feature would be incredibly useful. Not sure what happened to it.

I'm using openxlsx 4.2.5

Thank you for all your great work!

@JanMarvin
Copy link
Collaborator

Hi @David-Rattray , it looks like it was never merged. Would you like to carry the pull request over and try it out?

@David-Rattray
Copy link
Contributor Author

Hi @JanMarvin, yeah I would love to give it a whirl. However, I'm very unfamiliar with github. I'll see if I can figure out how to do that.

@JanMarvin
Copy link
Collaborator

Thanks, let me know if there's anything I can help you with on the openxlsx side of things. For GitHub there are countless guides how to do things, there will be one answering your questions :)

@David-Rattray
Copy link
Contributor Author

@JanMarvin I've been following the contribution guidelines for openxlsx:
usethis::create_from_github("ycphs/openxlsx", fork = TRUE),
after running devtools::check() there are zero errors, 1 warning, and 1 note. Not sure if that is fine to continue with or something to straight out first.

After that I'm going to try and figure out how to bring @DavidBreuer 's code from the pull request into a new pull request here.

@JanMarvin
Copy link
Collaborator

I'd say just start playing with the code :) Fixing things like warnings is a chore for after the implementation. No need to fix stuff only to realize that it doesn't work as expected.

@David-Rattray
Copy link
Contributor Author

@JanMarvin Managed to straighten out some of the problems, however test-encoding, and test-styles still produce errors when running the check. I've tried using it to produce a report, however I encounter an error (with Rcpp I think)
Error in write_worksheet_xml_2(prior = prior, post = post, sheet_data = ws$sheet_data, : Not compatible with STRSXP: [type=NULL].

See if I can figure it out, but if you have any ideas or suggestions that would be appreciated!

@JanMarvin
Copy link
Collaborator

Hi @David-Rattray , if you could open a PR I can have a look. Simply push your changes to your fork of openxlsx and click open pull request when the github popup appears. From this error alone, I'm not able to tell you where to look at. Either prior or post are not STRSXP (character), but NULL or something inside that function threw this error.

@David-Rattray
Copy link
Contributor Author

@JanMarvin Yeah I'll do that in a moment, I think its the row_heights_ = NULL part of the write_worksheet_xml_2.
Line 141 of the Rcpp Exports file

@JanMarvin
Copy link
Collaborator

I'll have a look, but maybe on the weekend. Thanks for pushing this forward :)

@David-Rattray
Copy link
Contributor Author

David-Rattray commented Jul 27, 2022

@JanMarvin hope I'm not bugging you. Just put together a minimal reproducible example for me at least.

library(openxlsx)
wb <- createWorkbook(creator = "David-Rattray")
addWorksheet(wb, sheetName = "Cover Page")
setColWidths(wb, sheet = "Cover Page", cols = 1:2, widths = 13)
setRowHeights(wb, sheet = "Cover Page", rows = 14, heights = 9.80)

saveWorkbook(wb, "C:/git projects/test/test.xlsx", overwrite = TRUE)
Error in write_worksheet_xml_2(prior = prior, post = post, sheet_data = ws$sheet_data,  : 
  Not compatible with STRSXP: [type=NULL].
> sessionInfo()
R version 4.0.5 (2021-03-31)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows 10 x64 (build 19044)

Matrix products: default

locale:
[1] LC_COLLATE=English_Canada.1252  LC_CTYPE=English_Canada.1252    LC_MONETARY=English_Canada.1252
[4] LC_NUMERIC=C                    LC_TIME=English_Canada.1252    

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base     

other attached packages:
[1] openxlsx_4.2.5.9000

loaded via a namespace (and not attached):
[1] compiler_4.0.5 tools_4.0.5    Rcpp_1.0.8.3   stringi_1.7.6  zip_2.2.0     
> 

I'll try and poke around a bit myself too

@JanMarvin
Copy link
Collaborator

No your not bugging me, it's just that I'm currently focusing on another project and switching back and forth is not always helpful. I'll get to it and thanks for the example.

@JanMarvin
Copy link
Collaborator

That's the output of the setRowHeights() example

Screenshot 2022-07-30 at 12 06 20

@Tom-K-UKRI
Copy link

Hello, I've tried using this in the latest version (4.2.5.2) and it's still not working. I'm assuming no one has had time to update it yet? No pressure - I just want to make sure I'm not just using it wrong. Thanks

@lewkrr
Copy link

lewkrr commented May 23, 2023

I would also love to see this feature implemented. Please consider merging if the code is functional.

Copy link

This issue is stale because it has been open 365 days with no activity. Remove stale label or comment or this will be closed in 7 days.

@github-actions github-actions bot added the Stale label May 25, 2024
Copy link

github-actions bot commented Jun 1, 2024

This issue was closed because it has been stalled for 7 days with no activity.

@github-actions github-actions bot closed this as completed Jun 1, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants