Module Properties > Document Content Attributes
Source File Extensions
Below is a list of the source file extensions that are supported through this feature, how their contents are inserted into the attribute, and additional options per the file type if applicable.
-
.docx, .doc, .docm, .rtf extensions are inserted as HTML.
-
.txt extensions are inserted as plain text only. They must be UTF-8 encoded to prevent problems with unreadable characters.
-
.pdf extensions are inserted as plain text by default. PDF files can be inserted as HTML by setting the Document Content Attributes: Insert PDFs as HTML? to Yes. Scanned PDFs can be read with OCR. See Scanned PDFs and Images (OCR) below.
Add .docx to the end of the destination attribute to convert the PDF to Word: FileUpload1=FileUpload2.docx
-
.xlsx, .xls, .xlsm, .xlsb extensions are inserted as HTML, with a tab for each visible worksheet. See Excel Workbooks below.
-
.png, .jpg, .jpeg, .tif, .tiff, .bmp, .gif extensions are read with OCR and inserted as plain text, only when Images is selected in Document Content Attributes: Read with OCR. Otherwise they are skipped. See Scanned PDFs and Images (OCR) below.
Scanned PDFs and Images (OCR)
Select Images, Scanned PDFs or both in Document Content Attributes: Read with OCR to read those files with OCR. OCR runs while the record saves and takes several seconds per page, so select only what the module needs.
-
When OCR reads text from the file, that text is inserted as plain text. For a scanned PDF it takes the place of the usual conversion, so Insert PDFs as HTML? has no effect.
-
When OCR finds no usable text, a PDF is converted as usual, as HTML or plain text per Insert PDFs as HTML?, and an image leaves the attribute empty. Any content from a previously uploaded file is cleared rather than left in place.
-
PDFs that are not scanned are always converted as usual.
How scanned PDFs are recognized, and the two OCR settings that decide what counts as usable text, are described in the OCR help file.
Excel Workbooks
-
Each visible worksheet gets its own tab, in the order the worksheets appear in the workbook. Clicking a tab above the worksheet shows that worksheet, and links in the workbook that point to another worksheet switch to that worksheet's tab. A workbook with a single visible worksheet is shown without tabs.
-
Values appear as they are displayed in Excel, including number, currency, percentage and date formats. Cells containing formulas show the value Excel last calculated, not the formula.
-
Formatting is preserved: fonts, bold and italic text, font and fill colors, cell borders, merged cells, column widths, row heights and text alignment. Pictures and charts placed on a worksheet are embedded in the HTML as images.
-
Not included: hidden worksheets, cell comments, filters, freeze panes and other interactive features. Hidden rows and columns on a visible worksheet are included in the HTML but hidden from view. Macros are never run, and links that would run a script, such as javascript: links, are disabled.
-
The Insert PDFs as HTML? property and the .docx suffix apply to PDFs only, and have no effect on workbooks.
-
The conversion matches the HTML produced by the FileReadAllText CpScript in Data Transfer when HTML output is requested, including the cell and character limits below. The file size limit applies only to Document Content Attributes.
Large Workbooks
A workbook is built for a spreadsheet application, not a web page. A large workbook produces far more HTML than a page can render in a reasonable time, and storing that much HTML in a record slows down saving the record, opening it in the Console, and the database itself. A workbook is only converted to HTML when it is within all of these limits:
-
25 MB file size. A larger file is not opened at all.
-
25,000 cells across its visible worksheets, counted on each worksheet from the first cell to the last cell holding data, including any hidden rows and columns in between.
-
5,000,000 characters of HTML. Pictures count toward this, so a small workbook with many screenshots can reach it.
A workbook over any of these limits is not converted, and the destination attribute is left empty. Any content from a previously uploaded file is cleared rather than left in place. A workbook that is password protected or cannot be read is handled the same way.
Viewing large workbooks: the Excel Viewer handles much larger workbooks than this conversion, loading rows as they are scrolled to. It has a limit of its own: each worksheet shows its first 5,000 rows, with a notice that the data is truncated. Past that, offer the workbook as a download to open in Excel.
Searching Workbook Content
To make a workbook's text searchable, also list the attribute holding the workbook in the Resource Content Attributes module property. Each distinct cell value in its visible worksheets is then added to the record's search content, including for workbooks too large to convert to HTML. Hidden worksheets are not included.
Customizing Workbook Tabs
The tabs and worksheets use these classes, and their default styles can be overridden by any rule in the site's stylesheet: .cpxl-wrap (the whole workbook), .cpxl-tabs (the tab strip, one table cell per tab), .cpxl-active (the selected tab), .cpxl-section (the area holding the worksheets) and .cpxl-sheet (each worksheet). A single-worksheet workbook uses only .cpxl-wrap.
.cpxl-tabs td.cpxl-active { background: #003366; }
.cpxl-tabs td.cpxl-active font { color: #fff; }