Azure / Azure/Microsoft365R

Excel email attachment does not show wrapped text in preview

Open
#203 2 comments 0 reactions 0 assignees View on GitHub
Dominant language
R
Stars
368
Forks
58
Avg merge
1h 42m
Merged PRs (30d)
4

Description

After downloading the attached email, the text is properly wrapped. However if left-clicking the attachment to preview, the text is not wrapped. And if you attach the file manually, the text will wrap in preview.

``` r
library(openxlsx2)
library(glue)
library(Microsoft365R)
.data <- structure(
list(
bldg = "5",
wo_num = "123421",
type = "BE",
category = "",
Description = "I am a description..............................................................................................................................................................................",
date = "02-22-24",
status = "S",
est_time = 1
),
row.names = c(NA, -1L),
class = c("tbl_df", "tbl", "data.frame")
)

wb_backlog <- function(.data) {
nm <- names(.data)
letter_desc <- letters[which(nm == "Description")] |> toupper()
letter_last <- letters[ncol(.data)] |> toupper()

wb_workbook() |>
wb_add_worksheet("Sheet1") |>
wb_add_data("Sheet1", .data) |>
wb_add_cell_style(
dims = glue("{letter_desc}2:{letter_desc}{nrow(.data) + 1}"),
wrap_text = "1"
) |>
wb_set_col_widths(cols = which(nm == "Description"), widths = 75)
}
wb <- .data |> wb_backlog()
## Text is wrapped
if (interactive()) wb |> wb_open()

tenant <- Sys.getenv("M365_TENANT")
app <- Sys.getenv("M365_APP")
user <- Sys.getenv("M365_USER")
pwd <- Sys.getenv("M365_KEY")

ol <- get_business_outlook(
tenant = tenant, app = app,
username = user, password = pwd,
auth_type = "resource_owner"
)
#> Loading Microsoft Graph login for tenant 'redacted'

file_1 <- tempfile(fileext = ".xlsx")

wb |> wb_save(file_1)

email <- ol$create_email(
subject = "Email subject",
to = "Created on 2024-03-12 with [reprex v2.0.2](https://reprex.tidyverse.org)

Contributor guide

Open the contributing guide

Research direction

Start with the R reproduction using wb_save(), create_email(), and add_attachment(), comparing the Outlook preview with a downloaded or manually attached workbook. Trace the attachment upload and preview behavior in Microsoft365R; done means wrapped cell text is preserved when previewing the generated Excel attachment.

Written by the indexing model from the issue text.

Assessment

Tech stack
r
Domain
api, cloud
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
42/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.