-
Notifications
You must be signed in to change notification settings - Fork 15
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
[reland] cleanup column width and font size setting #350
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@JanMarvin, I'm seeing an extra 0.25
on Windows. Column widths are appearing as 8.75
, 9.75
, etc.
Thanks @jmbarbone , I have modified their formula here: widths <- trunc((as.numeric(col_width) * mdw + 5 + 2) / mdw * 256) / 256 The |
@JanMarvin , removing the |
So their formula actually works on Windows. Maybe we should stick with that. |
52260b3
to
d227345
Compare
@jmbarbone If you find the time, could you please give this another feature test and run the check again? Just want to make sure that we set the column width correctly for Windows Excel. Unfortunately the width values are different on Mac and I haven't found a way to please both Excels. Might be a general issue: link to ms forum This changes the column width setting to calculate the values, whereas previously we simply set a value which was not identical to whatever Excel was using. This aligns a few functions to return width 8.43 and Calibri 11 font. I'd like to include this with 0.3.1 due to the more expected column widths. Prior to this PR you would set the width to 10 and would end up with something different, now you end up with column width 10 on Windows and 9.8 or so on Mac. |
2b537d4
to
b415286
Compare
7f697d4
to
3b075f2
Compare
@JanMarvin , with the current build the column widths seem fine when set to integers or integer-like values. Decimals seem to have some random offset: devtool::load_all()
wb <- wb_workbook()
wb$add_worksheet()
wb$add_data(x = rbind(8:17), colNames = FALSE)
wb$set_col_widths(cols = 1:10, width = (8:17) + seq(0.1, 1, .1))
wb$open()
|
Thanks. Might be related to the use of round. With .2 it is -0.06 and with .8 it's 0,06. Do you feel like this is reason enough to hold the pull request back? I'd say we can merge it the way it is and improve from there on (if we ever have to). After all it is already much better than the previous implementation. |
@JanMarvin , if this is an improvement from the current version, then it's probably good to include it Might just need a disclaimer:
|
I have updated to font size settings to default to column width of 8.43 and a font size of 11 and to use the windows size setting. On Mac the column width will be slightly off, but otherwise we'd have to skip a couple of tests.
This adjusts a few functions to use default column width of 10 and default font size 12. This is what MS365 uses on Mac. It is changed, because otherwise column widths were slightly off. 9. something instead of 10. Adjusted to this new values, all calculations are correct for Calibri. Yet, I would not bet that our calculations are valid for all versions. Previously we were using 8.43 and font size 11 as default. Which might be correct for the MS365 webbrowser edition or certain Windows low dpi versions.Maybe you can check the following on Windows @jmbarbone ? On Mac the column width is exactly 8.5 ... 17.5.
Orignal PR was #341 which was accidentally merged and reverted