OfficeDev / office-js

A repo and NPM package for Office.js, corresponding to a copy of what gets published to the official "evergreen" Office.js CDN, at https://appsforoffice.microsoft.com/lib/1/hosted/office.js.
https://learn.microsoft.com/javascript/api/overview
Other
674 stars 95 forks source link

Excel.createWorkbook(fileData) breaks relative (in-file) links in pivot tables. #4966

Open iarailopoulos opened 5 days ago

iarailopoulos commented 5 days ago

Provide required information needed to triage your issue

Your Environment

Expected behavior

Given I have an excel file with pivot tables and links in the same sheet (without any references to other files) Given I've read the file into memory as a base64 encoded string (fileData). When I use the Excel.createWork(fileData) Then the file opens in a new excel window and the links of the pivot tables still work and they are relative without file references.

Current behavior

Given I have an excel file with pivot tables and links in the same sheet (without any references to other files) Given I've read the file into memory as a base64 encoded string (fileData). When I use the Excel.createWork(fileData) Then the file opens in a new excel window and the links of the pivot tables do not work as they have links to an absolute file path that doesn't exist. For example when I am trying to click on Refresh Data from a pivot chart I get an error Can't open PivotTable source file '$PATH_TO_FILE/[blah.tmp]$SHEET_NAME'

Steps to reproduce

  1. Create a file that uses pivot tables (for example add a pivot chart)
  2. Try to use the Excel.createWorkbook(fileAsBase64String) to open it to a new file
  3. When the new file opens right click on the pivot chart, click on Refresh Data
  4. An error pops up Can't open PivotTable source file '$PATH_TO_FILE/[blah.tmp]$SHEET_NAME'

Link to live example(s)

  1. clone https://github.com/iarailopoulos/excel_pivot_create_workbook_bug (Relevant file is src/taskpane/components/CreatePivotWorkbook.tsx)
  2. npm install
  3. npm run dev-server
  4. npm start
  5. Click Load Data to load the excel file into memory image
  6. Click Create Pivot Workbook to create a new workbook image
  7. Open new workbook on the PIVOT tab image
  8. Right click on the chart and click Refresh Data image
  9. See error Can’t open PivotTable source file ’/path/to/temp/file/[fname.tmp]RAW DATA’ image

Provide additional details




Context

I am trying to allow users to download a file with pivot tables but the pivot table links don't work.

Useful logs

Thank you for taking the time to report an issue. Our triage team will respond to you in less than 72 hours. Normally, response time is <10 hours Monday through Friday. We do not triage on weekends.

qinliuMSFT commented 2 days ago

Hi @iarailopoulos , thank you for reporting this issue. I can reproduce on win32 application. We have filed an item #9443767 and put on our backlog, the team will investigate and reply to you as soon as there is any progress. Thank you for your patience.