Open vasuki-devi opened 1 month ago
@vasuki-devi Thanks for letting us know. Tagging @EsterBergen to take a look.
Thanks.
Hi @vasuki-devi - Thanks for submitting this. Can you confirm that the conversion to Base64 working on your end?
When I use the preview APIS to export to base 64 and then use insertSlidesFromBase64(), it works fine and formatting/shapes are the same.
Can you try using this api to convert the slide to be inserted to base 64 and then insert that? Here are more details: PowerPoint.Slide class - Office Add-ins | Microsoft Learn
We are using the Java.Util.Base64 encoder for converting pptx files to base64 format and is working fine from our end.
Still we are facing the formatting/shapes issues for the entire file of more than 10 files too. [Uploading Billing_model_comparison_single.pptx…]()
@EsterBergen Any update on this issue? We have a lot of customers using this feature, so any kind of information on this issue would be highly helpful. Thanks.
@vasuki-devi -- when i use the new preview api to exportAsBase64(), I don't have the same issue of different formats when inserting it into the presentation.
Have you tried that preview API for the export?
Here are more details: PowerPoint.Slide class - Office Add-ins | Microsoft Learn
@EsterBergen Can you please tell us how to use this new Preview API exportAsBase64(), we are facing issue on using this api to convert ppt file to base64? Sample code would work. Thanks!
slide.exportAsBase64();
Any update on this would be helpful?
We tried converting this sample file to base64 using normal converters in online as well as using Java.Util.Base64 but still facing the same issue on inserting slides with different format and styles. Any help on this? @EsterBergen Billing_model_comparison_single.pptx
@vasuki-devi Apologies for the delay. For the new Preview API, you'll want to reference the Beta API library https://appsforoffice.microsoft.com/lib/beta/hosted/office.js
@vasuki-devi -
Can you try two other things? 1) Update the insert code to remove the part of keep source formatting. When i try it, I don't define that and am able to get the formatting to hold.
Can you try this? `` await PowerPoint.run(async (context) => { const currentSlide = context.presentation.getSelectedSlides().getItemAt(0); currentSlide.load("id"); await context.sync();
context.presentation.insertSlidesFromBase64(base64, { targetSlideId: currentSlide.id });
}); }``
2) Ensure that Designer is not running on your slide after they are inserted
Thanks for the update @EsterBergen
It doesn't work though when we apply slides from another presentation file and not from the same file. We have both the usecases of "Keep Source Formatting" and "Use Destination" which doesn't working.
Also, we are converting the entire ppt file to be inserted using "insertSlidesFromBase64" and not the active ppt's individual slide base 64 conversion.
Alternate solution would be helpful for our usecase.
UseCases:
Note: exportAsBase64() works only on individual slide base64 conversion and which is beta version cannot be used in production cases. Java.Util.Base64 mime encoded value is used from our side for the entire PPT file conversion.
Thanks in advance!
HI @vasuki-devi - Using the preview API, I exported a slide as a base64 string and then inserted it into a new presentation. I observe the following: 1) All formatting is the same as the source if I don't define formatting. 2) All formatting is the same as the source if I say "KeepSourceFormatting", 3) Destination formats are applied if I say formatting='UseSourceFormatting'.
Can you share the Base64 string of your slide that you're importing? I'm happy to test that result on my end too.
My guess is that Java.Util.Base64 does not accurately capture all of the formatting from PPT and therefore is the main culprit. As this is not an Office.js PPT API, I can't really provide feedback to enhance that API.
We're working to release exportAsBase64() to production and can keep you updated with those timelines when the API will be generally available.
You are correct that this export is for a single slide. We have it on our backlog to make improvements and export multiple slides. The timeline for that has yet to be determined. I'll consider this as a feature request to have that expanded to include multiple slides.
Please let me know if there are any other questions!
Thanks for the update! @EsterBergen
Have attached the files containing base64 values of a pptx file that has similar formatting and alignment issues.
We are happy to hear about the version release planning dates for exportAsBase64() API enhancements to support base64 conversion.
Attached is the combination of single base64 value, uploaded as separate files due to file upload size limits to 25MB as an attachment here. [Uploading Test-Part1.txt…]() [Uploading Test-Part2.txt…]()
HI @vasuki-devi - I"m unable to download the files you attached unfortunately.
We'll be sure to provide updates here when we can on the release of the preview API beyond insiders.
Provide required information needed to triage your issue
Your Environment
Expected behavior
In my application, I'm using the 'Insert Slide from Base 64' function in Powerpoint API. The slide inserted should use the same original formatting from the PPTX file (from which the base64 string is created)
PowerPoint.run(function (context) { return context.sync.then(function(){ context.presentation.insertSlidesFromBase64(base64String),{ formatting: 'KeepSourceFormatting' }; return context.sync() }) });
Current behavior
The content formatting which is present in the original PPTX file is not carried over when using the PowerPoint API.
Steps to reproduce
Provide additional details
Context
I have an application, which stores a list of PPTX files in cloud, the user can select the file using the addin and insert all the slides from the PPTX file.
Useful logs
Lookup_addin_issue_file.pptx![msaddin-bug](https://github.com/OfficeDev/office-js/assets/169254071/2609851c-778d-4cca-a60f-cbc2e394e714)
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.