Coder Social home page Coder Social logo

MS Powerpoint Addin : Insert Slide from Base 64 Powerpoint addin API does not carry over the original formatting of the slide #2780 about office-js HOT 15 OPEN

vasuki-devi avatar vasuki-devi commented on August 10, 2024
MS Powerpoint Addin : Insert Slide from Base 64 Powerpoint addin API does not carry over the original formatting of the slide #2780

from office-js.

Comments (15)

vasuki-devi avatar vasuki-devi commented on August 10, 2024 1

@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();

from office-js.

ElizabethSamuel-MSFT avatar ElizabethSamuel-MSFT commented on August 10, 2024

@vasuki-devi Thanks for letting us know. Tagging @EsterBergen to take a look.

Thanks.

from office-js.

EsterBergen avatar EsterBergen commented on August 10, 2024

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

from office-js.

vasuki-devi avatar vasuki-devi commented on August 10, 2024

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…

from office-js.

vasuki-devi avatar vasuki-devi commented on August 10, 2024

@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.

from office-js.

EsterBergen avatar EsterBergen commented on August 10, 2024

@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

from office-js.

vasuki-devi avatar vasuki-devi commented on August 10, 2024

Any update on this would be helpful?

from office-js.

vasuki-devi avatar vasuki-devi commented on August 10, 2024

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

from office-js.

EsterBergen avatar EsterBergen commented on August 10, 2024

@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

PowerPoint.Slide class - Office Add-ins | Microsoft Learn

from office-js.

EsterBergen avatar EsterBergen commented on August 10, 2024

@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 });

});
}``

  1. Ensure that Designer is not running on your slide after they are inserted

from office-js.

vasuki-devi avatar vasuki-devi commented on August 10, 2024

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:

  1. Apply another PPT base64 with source formatting
  2. Apply another PPT base64 with destination formatting

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!

from office-js.

EsterBergen avatar EsterBergen commented on August 10, 2024

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!

from office-js.

vasuki-devi avatar vasuki-devi commented on August 10, 2024

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…

from office-js.

EsterBergen avatar EsterBergen commented on August 10, 2024

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.

from office-js.

vasuki-devi avatar vasuki-devi commented on August 10, 2024

Test-Part1.txt
Test-Part2.txt

That would be helpful!

Thanks much!

from office-js.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.