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

Preserve window size and position, also get and set #466

Closed
wants to merge 31 commits into from
Closed

Preserve window size and position, also get and set #466

wants to merge 31 commits into from

Conversation

michael-dewar
Copy link
Contributor

This PR will preserve the size and position of the window when you open the xlsx in Excel. There are also functions to set and get directly.

I had earlier created a PR #383, but it got hopelessly out-of-date with the changes to the package. I closed that old PR and created this new one. My hope is that this will allow a cleaner merge, assuming people find this PR useful.

michael-dewar and others added 30 commits April 19, 2024 10:27
[tests] fix broken skip_if_not_installed()
@epruesse
Copy link

@JanMarvin What would it take to get this merged? It's been on my wish list for a while. I too had a patch for this, just a bit more simplistic. I'm willing to work on this if @michael-dewar has no time and you've got specific criteria that would make the PR acceptable.

@JanMarvin
Copy link
Collaborator

Hi @epruesse , honestly, I have no intention to lead the development of openxlsx. I only took over maintenance as a favor to CRAN, @ycphs and to the many packages that depend on openxlsx, when CRAN was considering to archive openxlsx. I've been busy the last years developing openxlsx2 and my time and energy resources are limited.

As a last resort, if you can both agree that whatever is in this PR works with R and spreadsheet software and can confirm that you have tested things and it is in a merge-able state, lean as in not touching dozens of places, covered by tests, and nothing breaks - I'll be willing to merge it.

Merge branch 'master' of https://github.com/Tong-Ming-Enterprise/openxlsx

# Conflicts:
#	DESCRIPTION
#	R/data-fontSizeLookupTables.R
#	man/openxlsx.Rd
#	man/openxlsxFontSizeLookupTable.Rd
@michael-dewar
Copy link
Contributor Author

Hello @JanMarvin , thank you very much for taking over the maintenance of this project.

  1. I have made the PR mergeable by bringing it up to date with the changes to the master branch of ycphs since I made the PR. The commit history above looks long, but most of those are from when I brought my branch up to date. My changes are only contained in four commits from April 19, 2024.
  2. The code changes are very lean. They only touch the bare minimum in order to preserve and set the window size. I do not change other code.
  3. The new functions are documented.
  4. The new code has tests in a file called test-setWindowSize.R. All of the new and old tests pass without issue.
  5. devtools::check() has no issues.
  6. I have built the package in both Windows 11 and macOS Sonoma 14.5. I am able to use the new features to read and write xlsx files and the window size and position features work as expected when I open the files in Excel for Mac. When I open them in Excel for Windows 11, the window size and position feature appeared to have no effect. But at least they were not corrupted or anything. I can also open the files correctly in the web version of Excel and in Numbers for Mac, although the windows size features are not relevant there.

@epruesse , are you able to test the feature on Windows?

@epruesse
Copy link

I don't use windows myself, but I may be able to find someone, at least to check the resulting files.

@JanMarvin
Copy link
Collaborator

Can you please rebase the PR? It’s currently touching 47 files, including GitHub workflows, which is not lean at all 😉

@michael-dewar
Copy link
Contributor Author

I can create a new PR, but I am unable to rebase this one. I originally tried to rebase it, but my git skills were not up to the task.

@JanMarvin
Copy link
Collaborator

Thanks, understandable - git can be challenging, but that would be lovely! Please try to reduce the changes to the minimum.

@michael-dewar
Copy link
Contributor Author

@JanMarvin @epruesse I have created a clean PR from a rebased branch. Please see PR #487 . Thanks.

netbsd-srcmastr pushed a commit to NetBSD/pkgsrc that referenced this pull request Jan 4, 2025
# openxlsx 4.2.7.1

* It's now possible to insert a hyperlinked image by passing a URL,
  relative or absolute file path, or mailto string to the new
  `address` parameter of `insertImage()`.

# openxlsx 4.2.7

* Fixed warning on `dataValidation(..., type = "list")`
  ([#342](ycphs/openxlsx#342))

* Added optional argument to `loadWorkbook` to decide if empty/blank
  cells should be converted to NA_character_ (the default) or left
  blank as is

* `saveWorkbook()` now succeeds when called after the user has set
  column widths for a range of columns (e.g. 1:2), saved the workbook,
  then set column widths for a new range that is inclusive of the
  previous one (e.g. 1:5)
  ([#493](ycphs/openxlsx#493)).

## Improvements

* Improve detectDates
  ([#288](ycphs/openxlsx#288))

* Preserve window size and position, also `getWindowSize()` and
  `setWindowSize()`
  ([466](ycphs/openxlsx#466))

# openxlsx 4.2.6

* Fix external links
  ([#410](ycphs/openxlsx#410))

* Do not add unneccessary sheetPr node
  ([#409](ycphs/openxlsx#409))

* Add support for `namedRegion`s having dots and other special
  characters ([#338](ycphs/openxlsx#338)).

* Add type blanks and not blanks to conditional formatting
  ([#311](ycphs/openxlsx#311))

# openxlsx 4.2.5

## Fixes

* `openxlsx_setOp()` now works with named list
  ([#215](ycphs/openxlsx#215))

* `loadWorkbook()` imports `inlineStr`. Values remain `inlineStr` when
  writing the workbook with `saveWorkbook()`. Similar `read.xlsx` and
  `readWorkbook` import `inlineStr`.

* `read.xlsx()` no longer changes random seed
  ([#183](ycphs/openxlsx#183))

* fixed a regression that caused fonts to be read in incorrectly
  ([#207](ycphs/openxlsx#207))

* add option to save as read only recommended
  ([#201](ycphs/openxlsx#201))

* fixed writing hyperlink formulas
  ([#200](ycphs/openxlsx#200))

* `write.xlsx()` now throws an error if it doesn't have write
  permissions ([#190](ycphs/openxlsx#190))

* `write.xlsx()` now again uses the default of `overwrite = TRUE` for
  saving files ([#249](ycphs/openxlsx#249))

* `as.character.formula()` exported to warn about potential conflicts
  with other packages
  ([#312](ycphs/openxlsx#312),
  [#315](ycphs/openxlsx#315))

## Improvements

* `options()` are more consistently set in functions (see:
  [#289](ycphs/openxlsx#262))

* `Workbook$show()` no longer fails when called in a 0 sheet
  workbook([#240](ycphs/openxlsx#240))

* `read.xlsx()` again accepts `.xlsm` files
([#205](ycphs/openxlsx#205),
[#209](ycphs/openxlsx#209))

* `makeHyperlinkString()` does no longer require a sheet argument
  ([#57](ycphs/openxlsx#57),
  [#58](ycphs/openxlsx#58))

* improvements in how `openxlsx` creates temporary directories (see
  [#262](ycphs/openxlsx#262))

* `writeData()` calls `force(x)` to evaluate the object before options
  are set ([#264](ycphs/openxlsx#264))

* `createComment()` now correctly handles `integers` in `width` and
  `height` ([#275](ycphs/openxlsx#275))

* `setStyles()` accepts `halign="justify"`
  ([#305](ycphs/openxlsx#305))
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.

4 participants