How is your experience with the OutSystems Community?
file-viewer
Reactive icon

Office To Html Reactive / File viewer

Stable version 1.0.5 (Compatible with OutSystems 11)
Uploaded
 on 27 Oct (14 hours ago)
 by 
4.8
 (4 ratings)
file-viewer

Office To Html Reactive / File viewer

Compatible with:
Created on OutSystems 11

Version 1.0.5

Stable
Current
See documentation
Uploaded on 13:10 (one hour ago) by 
Compatible with:
Version 11
↳11.12.0 or higher
Database:
All
Release notes:


This release fixes the reported PPTX error ("Invalid or corrupted PDF file" when uploading a PowerPoint) and about 15 other defects in OfficeToHtml_Reactive. Existing apps keep working without changes.

It also adds two optional features: viewing Binary Data and forcing a file type. Clear error messages now replace blank viewers. Every public element now has a meaningful description, and the demo app was redesigned.






Bug fixes

PPTX upload failed with "Invalid or corrupted PDF file". The embedded PDF.js viewer listened to every file input on the page and never stopped. After one PDF had been shown, the next PPTX, DOCX or XLSX upload was opened as a PDF. It also kept listening after the user left the screen. PDF.js now only handles its own "Open file" button, and its listeners are released when another file type is shown or the block is destroyed.

Area

Problem

Fix

File picker

Cancelling the file dialog threw a JavaScript error

Cancel is ignored; the current preview stays

Re-initialisation

Each re-init added another upload handler

Handlers are namespaced and replaced, not stacked

Memory

Blob URLs of picked files were never released

Previous URL is revoked on each new file and on destroy

Multiple viewers

Every instance used the hard-coded input id grv, so viewers interfered

Each instance gets a unique input id; a custom InputObjId is still respected

Parameter changes

Changing OptionalConfiguration at runtime was ignored

Block re-renders on change and skips it when nothing changed

Keyboard

PDF.js shortcuts stayed active on other screens

Released with the viewer

URLs

file.pptx?token=… was not recognised as PPTX

Query strings and fragments are ignored when detecting the type

DOCX

Load or conversion errors were uncaught; viewer stayed blank

Message shown in the viewer

Spreadsheets

Network or parse errors were uncaught

Message shown in the viewer, including HTTP status

PPTX

Corrupt files or failed downloads were uncaught

Message shown in the viewer

DOCX RTL

IsRtl only worked with Boolean values the Text attribute could not pass

Accepts "rtl", "ltr" and "auto"

Element ids

Math.floor() produced NaN in generated ids

Uses Math.random()

PDF.js path

Crashed if the pdf.js script tag was not found

Guarded with a fallback

Console

Settings and paths were logged on every load

Debug logging removed


New features

All additions are optional; existing apps don't need to change anything.

Element

Type

What it does

OfficeToHtmlConfig.FileType

Structure attribute (Text)

Forces the viewer to use a file type (e.g. "pdf") when the url has no extension

OfficeToHtml_CreateFileUrl

Public client action

Turns Binary Data (e.g. from the database) into a browser URL the viewer can show; file type is read from FileName

OfficeToHtml_RevokeFileUrl

Public client action

Releases a URL created by OfficeToHtml_CreateFileUrl to free browser memory

OnParametersChanged handler

Block behaviour

Viewer reloads when OptionalConfiguration changes at runtime

OnDestroy handler

Block behaviour

Releases listeners and URLs when the block leaves the screen

In-viewer error messages

Block behaviour

Missing, unreachable or corrupt files show a readable message instead of a blank area

To show a file stored as Binary Data:

  1. Call OfficeToHtml_CreateFileUrl with FileContent and FileName (e.g. Report.pdf).
  2. Pass its FileUrl output to OptionalConfiguration.url.
  3. Call OfficeToHtml_RevokeFileUrl when the file is no longer shown.

Improvements

  • Documentation: every public element now has a meaningful description: the block, its input and GetFile event (with both parameters), 2 client actions, 7 structures and all 78 attributes. Each attribute states what it does, its allowed values and its default.
  • Accepted files: the file picker now offers every supported format: pdf, docx, pptx, xls, xlsx, xlsm, xlsb, csv, ods, png, jpg, jpeg, gif, bmp, svg, tif, tiff.
  • Block description: rewritten with usage steps (URL mode, file picker mode, Binary Data, FileType) and the one-PDF-per-screen note.
  • Cleaner runtime: no debug output in the browser console; the PDF viewer no longer intercepts keyboard and mouse events after the user moves to another file or screen.

Upgrade notes

The release is backward compatible: no public element was renamed or removed, and no data type changed. Existing screens keep their current behaviour.

  1. Open each consumer app in Service Studio.
  2. Refresh its references to OfficeToHtml_Reactive (Manage Dependencies). Publishing the component reports "Potential Incompatible Consumer" until you do, because a public structure gained the FileType attribute.
  3. Publish the consumer.

Nothing else is required. To use the new features, see New features above.

Demo app (OfficeToHtml_Demo)

The demo was redesigned with a glassmorphism red-and-black theme, written as classes in the theme stylesheet (no inline styles) and responsive down to phone width. The footer "Made with ❤️ using OutSystems." is in the layout, so it shows on every screen.

Screen

What it shows

Home (new)

Overview, a tile per demo, how to use, supported formats

Upload

File picker preview plus the GetFile event output (file name, type, count)

PDF

PDF.js viewer with Open file and Bookmark buttons hidden through PdfSetting

Word

DOCX with IgnoreEmptyParagraphs

PowerPoint

PPTX in slide mode

Excel

Workbook with search and read-only mode

Image

Image with the rotate toolbar

Errors (new)

Unsupported file, legacy .doc and missing file side by side

Each viewer page shows a full-width live preview, the exact OptionalConfiguration used, and what to try. The demo previously pointed at one cloud environment (personal-l9q0mrdp.outsystemscloud.com); sample files are now loaded with GetOwnerURLPath(), so it works in any environment.

Application Objects:
Office To Html Reactive / File viewer has 0 AOs.

Version 1.0.4

Stable
See documentation
Uploaded on 24 Jun by 
Compatible with:
Version 11
↳11.12.0 or higher
Database:
All
Release notes:

Bug Fix

  • Fixed crash when uploading certain .pptx files (Cannot read properties of null - 'asText')
  • Added null guard in readXmlFile to handle missing internal XML entries in zip gracefully

Compatibility

  • Confirmed JSZip v2 dependency requirement
Application Objects:
Office To Html Reactive / File viewer has 0 AOs.

Version 1.0.3

Stable
See documentation
Uploaded on 03 June 2025 by 
Compatible with:
Version 11
↳11.12.0 or higher
Database:
All
Release notes:
  • Enhanced File Support

    • Added support for the following file types in the file input:

      • PDF (.pdf)

      • Word Documents (.docx)

      • PowerPoint Presentations (.pptx)

      • Excel Sheets (.xls, .xlsx)

      • Images (JPG, PNG, etc.)

    • HTML input Element now uses:

      <input type="file" accept=".pdf, .docx, .pptx, .xls, .xlsx, image/*" />
  • UI Improvements (Demo Application)

    • Redesigned the Demo UI for a cleaner, more attractive look and better user experience.

    • Updated layout, icons, and styling for improved visual appeal and usability.

Application Objects:
Office To Html Reactive / File viewer has 0 AOs.