0

I need to convert my byteArray response into ppt Blob Object to create a .ppt/.pptx file in Angular 2. I am able to convert to image and pdf formats. But I need specifically for ppt and pptx formats.

var blob = new Blob(resp, {type: 'application/pdf'});

AS above, what is the type to be given for ppt or pptx conversion?

Please mention if I need to add more details.

2 Answers 2

3

You are looking for Microsoft PowerPoint MIME Types:

  • .ppt (proprietary format before PowerPoint 2007)

application/vnd.ms-powerpoint

  • .pptx (open format since PowerPoint 2007)

application/vnd.openxmlformats-officedocument.presentationml.presentation

Sign up to request clarification or add additional context in comments.

Comments

0

If someone finds this and wants to typify it in someway for TypeScript, here's my approach:

export type ReportGenerationFormat = 'PPT' | 'WORD' | 'PDF';

interface ReportFileType {
  extension: string;
  mimeType: string;
}

/**
 * File name extensions and their MIME Types.
 * PPT is a proprietary format before PowerPoint 2007.
 * PPTX is an open format since PowerPoint 2007.
 * PDF is self-explanatory.
 * DOC is a Microsoft document before Word 2007.
 * DOCX is a Microsoft Word document.
 */
export const ReportFileTypes: Record<string, ReportFileType> = {
  PPT: { extension: '.ppt', mimeType: 'application/vnd.ms-powerpoint' },
  PPTX: { extension: '.pptx', mimeType: 'application/vnd.openxmlformats-officedocument.presentationml.presentation' },
  PDF: { extension: '.pdf', mimeType: 'application/pdf' },
  DOC: { extension: '.doc', mimeType: 'application/msword' },
  DOCX: { extension: '.docx', mimeType: 'application/vnd.openxmlformats-officedocument.wordprocessingml.document' },
};

And then all you have to do is import that constant and utilise it with the fileType, like so: ReportFileTypes[fileType].mimeType

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.