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

provide col to df funcions #25

Merged
merged 3 commits into from
Jan 3, 2022
Merged

provide col to df funcions #25

merged 3 commits into from
Jan 3, 2022

Conversation

JanMarvin
Copy link
Owner

@JanMarvin JanMarvin commented Jan 3, 2022

This pull request provides functions to import <col .../> nodes to a data frame and a function to create a <col .../> node from a data frame. Both functions might be used with loadWorkbook and saveWorkbook. They provide what is required to easily modify <col .../>.

Contrary to rows, columns do not have to be present for each column of a data frame. There can be a single column handling multiple columns.

@JanMarvin JanMarvin merged commit ba1791b into main Jan 3, 2022
@JanMarvin
Copy link
Owner Author

JanMarvin commented Jan 3, 2022

> cols_df <- openxlsx2:::col_to_df(read_xml(wb$worksheets[[1]]$cols_attr))
> openxlsx2:::df_to_col(cols_df)
> openxlsx2:::empty_cols_attr()
[1] "<col collapsed=\"false\" customWidth=\"true\" hidden=\"false\" max=\"1\" min=\"1\" outlineLevel=\"0\" style=\"0\" width=\"3.45\"/>" 
[...]
> cols_df
  bestFit collapsed customWidth hidden max min outlineLevel phonetic style width
0             false        true  false   1   1            0              0  3.45
1             false        true  false   2   2            0              0 11.33
2             false        true  false   3   3            0              0  7.65
3             false        true  false   4   4            0              0 10.14
4             false        true  false   5   5            0              0  7.65
5             false        true  false   6   6            0              0  9.55
6             false        true   true   7   7            0              0  9.15
7             false        true  false   8   8            0              0  7.65
8             false        true  false   9   9            0              0  9.55

@JanMarvin JanMarvin deleted the col_attr branch January 9, 2022 00:18
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.

None yet

1 participant