OFFICETOHTML_FileView previews PDF, Word, PowerPoint, spreadsheet and image files inside an OutSystems Reactive Web app. Everything is rendered in the browser: no server conversion, no plugin, nothing uploaded. Module: OfficeToHtml_Reactive (Forge).
OfficeToHtml_Reactive
The block works in two modes:
OptionalConfiguration.url
url
GetFile
Format
Extensions
Rendered with
PDF
pdf
PDF.js viewer (toolbar, thumbnails, search, print)
Word
docx
mammoth.js (converted to HTML)
PowerPoint
pptx
PPTXjs + divs2slides (slide mode)
Spreadsheet
xlsx, xls, xlsm, xlsb, csv, ods, fods, dif, slk, prn, dbf
SheetJS + Handsontable (one tab per sheet)
Image
png, jpg, jpeg, gif, bmp, svg, tif, tiff
verySimpleImageViewer (zoom, pan, rotate)
Not supported
doc, ppt
A message asks the user to convert to docx or pptx
OFFICETOHTML_FileView
OfficeToHtml_CreateFileUrl
OfficeToHtml_RevokeFileUrl
OptionalConfiguration
{ url: GetOwnerURLPath() + "Report.pdf" }
{ }
Files added to your module under Data > Resources with Deploy Action "Deploy to Target Directory" are reachable at GetOwnerURLPath() + "<file name>". Encode spaces in the name (data%20(1).xlsx).
GetOwnerURLPath() + "<file name>"
data%20(1).xlsx
Shows one file. The viewer area is 800 px tall and scrolls inside itself.
Input parameter
Name
Type
Mandatory
Description
OfficeToHtmlConfig
No
What to display and how. Set url to show a file from a URL; leave it empty to show a file picker. Changing the value at runtime reloads the viewer (identical values are ignored).
Event
Triggered when
The user picks a file with the block's file picker (only when url is empty). The file is previewed automatically; handle the event to save or upload it.
Event parameter
FIle
Binary Data
Content of the picked file
FileName
Text
Name of the picked file, including its extension (e.g. Report.pdf)
Lifecycle
OfficeToHtml_CreateFileUrl turns Binary Data into a browser object URL the block can display. The file name is appended as a fragment (blob:…#Report.pdf) so the viewer can detect the type.
blob:…#Report.pdf
Parameter
Direction
FileContent
In
Yes
Content of the file, e.g. from a database record or an upload widget
File name with extension (e.g. Report.pdf); the extension selects the viewer
MimeType
MIME type (e.g. application/pdf); leave empty if unknown
FileUrl
Out
—
Object URL to pass to OfficeToHtmlConfig.url; empty when FileContent is empty
OfficeToHtmlConfig.url
OfficeToHtml_RevokeFileUrl releases a URL created by OfficeToHtml_CreateFileUrl to free browser memory. Call it before creating a new URL for the same viewer, and in the screen's OnDestroy.
URL returned by OfficeToHtml_CreateFileUrl; other URLs are ignored
The top level chooses the file; each format reads only its own settings group, and PptxSetting nests SlideModeConfig.
Every attribute is optional; attributes you leave out keep their default. In an expression you can set only what you need, e.g. { url: "a.pdf", PdfSetting: { PrintBtn: False } }.
{ url: "a.pdf", PdfSetting: { PrintBtn: False } }
Attribute
Default
""
File to display (absolute, relative, or an object URL from OfficeToHtml_CreateFileUrl). Empty = show the file picker. Other domains need CORS.
FileType
Forces the type (e.g. "pdf", "docx") when the url has no extension. Empty = detect from the extension.
inputObjId
"grv"
Advanced. Id of the file input to listen to. Keep "grv" for the block's own picker; set another input's id to drive the viewer from it; "" disables picking.
PdfSetting
PDF viewer options
DocxSetting
Word options
PptxSetting
PowerPoint options
SheetSetting
Spreadsheet options
ImageSetting
Image options
Every Boolean shows (True) or hides (False) a toolbar control; all default to True.
Controls
SetLang
Interface language, e.g. "en-US", "fr" (list); empty = browser language
ThumbnailViewBtn
Boolean
True
Sidebar with thumbnails and outline
SearchBtn
Find in document
NextPreviousBtn
Next / previous page
PageNumberTxt
Page number box
TotalPagesLabel
Total pages label
ZoomBtns
Zoom in / out
ScaleSelector
Zoom level dropdown
PresantationModeBtn
Presentation mode (full screen)
OpenFileBtn
Open another PDF from the computer
PrintBtn
Print
DownloadBtn
Download
BookmarkBtn
Open current view in a new window
SecondaryToolbarBtn
Tools menu
FirstPageBtn
Tools menu: first page
LastPageBtn
Tools menu: last page
PageRotateCwBtn
Tools menu: rotate clockwise
PageRotateCcwBtn
Tools menu: rotate counterclockwise
CursorSelectTextToolbarBtn
Tools menu: text selection tool
CursorHandToolbarBtn
Tools menu: hand tool
IncludeEmbeddedStyleMap
Use the style map embedded in the document
IncludeDefaultStyleMap
Apply mammoth.js' default style map (Heading 1 → h1, ...)
IgnoreEmptyParagraphs
False
Skip empty paragraphs
IdPrefix
Prefix for generated element ids, to avoid clashes on the page
IsRtl
"rtl", "ltr" or "auto" (detects Hebrew only); empty = direction not changed
Mouse
Zoom with the mouse wheel, pan by dragging
Keyboard
Zoom and move with +, - and arrow keys
Toolbar
Show the zoom toolbar
RotateToolbar
Show rotate buttons
SlidesScale
Slide scale, e.g. "50%"; empty = original size
SlideMode
One slide at a time with navigation; False = all slides listed
KeyBoardShortCut
F5 enters / leaves slide mode (SlideMode must be True)
MediaProcess
Process embedded audio and video; False loads faster
JsZipV2
Keep False; JSZip v2 is already included
SlideModeConfig
Slide mode options below
First
Long Integer
1
Slide shown first
Nav
Previous / next buttons
NavTxtColor
"black"
CSS color of the slide counter
Arrow keys navigate; F8 starts / stops auto-play
ShowSlideNum
Show current slide number
ShowTotalSlideNum
Show total slide count
AutoSlide
Seconds per slide during auto-play
RandomAutoSlide
Auto-play in random order
Loop
Return to the first slide after the last
Background
Keep False (default background)
Transition
"default"
"slid", "fade", "default" or "random"; visible when TransitionTime > 0.5
TransitionTime
Transition duration in seconds
Options passed to Handsontable for every sheet.
Search
Search box that highlights matching cells
ReadOnly
Prevent editing (changes are never saved to the file anyway)
ColumnSorting
Click a header to sort
SortIndicator
Arrow on the sorted column
RowHeaders
Row numbers
ColHeaders
Column letters
FixedRowsTop
0
Frozen rows at the top
FixedColumnsLeft
Frozen columns on the left
AutoColumnSize
Fit column widths to content
AutoRowSize
Fit row heights to content (slower)
SelectionMode
"single"
"single", "range" or "multiple"
Copyable
Ctrl+C copies selected cells
ContextMenu
Right-click menu
CustomBorders
Custom cell borders
AllowEmpty
Empty cells allowed when editable
ActiveHeaderClassName
CSS class on headers of selected cells
Language
"en-US"
Grid interface language
StartRows
Minimum rows for an empty sheet
StartCols
Minimum columns for an empty sheet
Jqueryui
Use jQuery UI tabs (needs jQuery UI CSS)
Columns
Keep False (all columns shown)
Width
Keep False (grid as wide as the viewer)
Height
Keep False (grid as tall as the viewer)
Use case
File from the module's resources
Let the user pick any file
Read-only PDF (no print, download or open)
{ url: FileUrl, PdfSetting: { PrintBtn: False, DownloadBtn: False, OpenFileBtn: False } }
URL without an extension (e.g. a REST endpoint)
{ url: "/api/files/42", FileType: "pdf" }
Searchable, read-only spreadsheet
{ url: FileUrl, SheetSetting: { Search: True, ReadOnly: True } }
All slides listed, no slide mode
{ url: FileUrl, PptxSetting: { SlideMode: False } }
Arabic or Hebrew Word document
{ url: FileUrl, DocxSetting: { IsRtl: "rtl" } }
Image with rotate buttons
{ url: FileUrl, ImageSetting: { RotateToolbar: True } }
Show a file stored in the database
GetDocument.List.Current.Document.File
{ url: FileUrl }
Save the file the user picked
Symptom
Cause
Fix
"The file is not supported!"
Extension not recognised, or the url has none
Check the file name, or set FileType
".doc / .ppt file is not supported"
Legacy binary Office format
Convert to .docx / .pptx
"Unable to load the document / spreadsheet / presentation"
URL returns 404, needs login, or is blocked by CORS
Open the URL in a new tab; enable CORS on the other server; use OfficeToHtml_CreateFileUrl for protected files
"Invalid or corrupted ... file"
The file is damaged or not really that format
Re-save the file in Office and try again
PPTX opened as PDF ("Invalid or corrupted PDF file")
Older component version
Update to the latest version and refresh references
Second PDF on the same screen is broken
PDF.js uses fixed element ids
Show one PDF per screen
Spreadsheet grid looks cut off
Viewer height (800 px) is smaller than the sheet
The grid scrolls inside the viewer; use FixedRowsTop for headers
Old preview stays after changing the url
Consumer still references an old component version
Refresh references and republish the consumer
Limitations
The OfficeToHtml_Reactive component for OutSystems leverages the "OfficeToHtml" jQuery plugin to convert Office files (PPTX, DOCX, XLSX) and PDF documents to HTML using pure JavaScript. This component enables seamless integration and easy file viewing within your OutSystems applications.
Adding the Component:
Using URL as Input:
Using File Upload:
docxSetting:
pptxSetting:
sheetSetting:
imageSetting: