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

I can't see the preview with iphone of a .xlsx file sent by email created with openxlsx #484

Closed
AleTinaba93 opened this issue Jul 29, 2024 · 8 comments

Comments

@AleTinaba93
Copy link

AleTinaba93 commented Jul 29, 2024

i created a file in this way:

wb_test1 <- createWorkbook()
addWorksheet(wb_test1, "KPI business")
writeData(wb_test1, sheet = 1, x = "Liquidity * (ECB rate - 0.25)",
startCol = 1, startRow = 2, colNames = FALSE)
addStyle(wb_test1, sheet = 1, rows = 2, cols = 1, style =
createStyle(halign = "center", valign = "center", textDecoration = "bold", wrapText = TRUE,
border = "TopBottomLeftRight"), gridExpand = TRUE)
saveWorkbook(wb_test1, "results/test1.xlsx", overwrite = TRUE)

i sent it by email and unfortunately if i try to open it with my iphone i can't see the preview because "is not supported" but i can opened it if i use excel app, but i need to be able to see alredy the preview. If i use write.xlsx to save file it works but i lose the whole formattation. Any solutions?

@JanMarvin
Copy link
Collaborator

Try openxlsx2. There are known issues with openxlsx.

@AleTinaba93
Copy link
Author

solved! It works

@AleTinaba93
Copy link
Author

AleTinaba93 commented Jul 31, 2024

unfortunately i can see the preview but losting all of customized formattation. Is there a way to see by using a smartphone the preview with the customized formattation without the excel app installed in the smartphone?

@JanMarvin
Copy link
Collaborator

You must be doing something wrong. If you can provide some code for a minimal example to reproduce what you are doing. Otherwise, it works fine with ms365 on my phone.

@AleTinaba93
Copy link
Author

pkgEnv$wb_revenues_arpu <- openxlsx2::wb_workbook()
pkgEnv$wb_revenues_arpu$add_worksheet("test1")
pkgEnv$wb_revenues_arpu$add_data("test1", x = pkgEnv$TAB, na.strings = "", start_col = 1,
start_row = 1, col_names = TRUE)
pkgEnv$wb_revenues_arpu$add_data("test1", x = "Tasso", na.strings = "", start_col = 1, start_row = 20, col_names = FALSE)
pkgEnv$wb_revenues_arpu$add_data("test1", x = t(pkgEnv$tassi_chart$EBC), na.strings = "", start_col = 2,
start_row = 20, col_names = FALSE)
pkgEnv$wb_revenues_arpu$add_numfmt("test1", dims = "B20:N20", numfmt = "0.00%")
pkgEnv$wb_revenues_arpu$set_col_widths("test1", cols = 1:pkgEnv$ncols, widths = 7.5)
pkgEnv$wb_revenues_arpu$add_cell_style("test1", dims = "A1:P20", horizontal = "center", vertical = "center", wrap_text = 1)
pkgEnv$wb_revenues_arpu$add_numfmt("test1", dims = "B2:P18", numfmt = "#,##0\u20AC")
pkgEnv$wb_revenues_arpu$add_dxfs_style(name = "negStyle", font_color = openxlsx2::wb_color(hex = "#9C0006"),
bgFill = openxlsx2::wb_color(hex = "#FFC7CE"))
pkgEnv$wb_revenues_arpu$add_dxfs_style(name = "posStyle", font_color = openxlsx2::wb_color(hex = "#006100"),
bgFill = openxlsx2::wb_color(hex = "#C6EFCE"))

openxlsx2::wb_save(pkgEnv$test1, "results/test1.xlsx", overwrite = TRUE)

@JanMarvin
Copy link
Collaborator

Please, something to reproduce ...

TAB <- mtcars[1:10, ]
# t(tassi_chart$EBC)
t_tassi_chart_EBC <- t(1:2)
ncols <- ncol(TAB)

wb_revenues_arpu <- openxlsx2::wb_workbook()
wb_revenues_arpu$add_worksheet("test1")
wb_revenues_arpu$add_data("test1", x = TAB, na.strings = "", start_col = 1,
                                 start_row = 1, col_names = TRUE)
wb_revenues_arpu$add_data("test1", x = "Tasso", na.strings = "", start_col = 1, start_row = 20, col_names = FALSE)
wb_revenues_arpu$add_data("test1", x = t_tassi_chart_EBC, na.strings = "", start_col = 2,
                                 start_row = 20, col_names = FALSE)
wb_revenues_arpu$add_numfmt("test1", dims = "B20:N20", numfmt = "0.00%")
wb_revenues_arpu$set_col_widths("test1", cols = 1:ncols, widths = 7.5)
wb_revenues_arpu$add_cell_style("test1", dims = "A1:P20", horizontal = "center", vertical = "center", wrap_text = 1)
wb_revenues_arpu$add_numfmt("test1", dims = "B2:P18", numfmt = "#,##0\u20AC")
wb_revenues_arpu$add_dxfs_style(name = "negStyle", font_color = openxlsx2::wb_color(hex = "#9C0006"),
                                       bgFill = openxlsx2::wb_color(hex = "#FFC7CE"))
wb_revenues_arpu$add_dxfs_style(name = "posStyle", font_color = openxlsx2::wb_color(hex = "#006100"),
                                       bgFill = openxlsx2::wb_color(hex = "#C6EFCE"))
wb_revenues_arpu$save("~/Documents/test.xlsx")

IMG_1825

Works fine. Looks the same on Mac and iPhone

@AleTinaba93
Copy link
Author

yes but you opened it by using excel app, instead i mean just the preview in which you see it just in reading mode so without using office app or excel app

@JanMarvin
Copy link
Collaborator

Do you mean the thumbnail here as in the following screenshot? If so, that's probably a limitation by numbers or whatever application iOS uses to create the thumbnail.

Open folder Documents jpeg

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

No branches or pull requests

2 participants