1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.
  2. Anuncie Aqui
    Anuncie aqui você Também: fdantas@4each.com.br

How do I display a preview for a Word document from a base 64 string? [closed]

Discussão em 'Angular' iniciado por ck-s, Julho 1, 2025.

  1. ck-s

    ck-s Guest

    Is there any library for Angular that can display a preview for word documents from a base 64 string? I was looking for some examples but I didn't find any.

    I have found a library called ngx-doc-viewer, it has expects a url but I have a base 64 string, which I need to transform into a word document. So i'm looking for a better solution.

    convertAndDownload(base64Data: string, fileName: string) {
    const byteCharacters = atob(base64Data);
    const byteNumbers = new Array(byteCharacters.length);
    for (let i = 0; i < byteCharacters.length; i++) {
    byteNumbers = byteCharacters.charCodeAt(i);
    }
    const byteArray = new Uint8Array(byteNumbers);
    const blob = new Blob([byteArray], { type: 'application/msword' });
    saveAs(blob, fileName + '.doc');
    }


    The above code uses the saveAs method but I'm looking to display a preview of the word document.

    Continue reading...

Compartilhe esta Página