Once the L4X editor/debugger (IDE) is "added-in" to Excel, you will be able to see the L4X menu on Excel's main menu-bar. In Excel 2007, you should be able to see the [Add-ins] tab on the "ribbon" at the top of the form, click on this tab to find the L4X menu on the left of the [Add-ins] page.

L4X menu in Excel

L4X menu in Excel
The L4X editor/debugger allows you to create, edit and test L4X scripts. The form has two panels:

Use the controls in this pane to edit and run the L4X script that controls how the L4X filter imports text into a worksheet. This page contains the following controls:

Enter and edit your script in the edit control, at the top-left of this panel. This control understands Lua syntax and it will show Lua key words in bold text and also color text-strings, numbers and comments. You can edit your script when it is not running and it is not in a protected worksheet.
The status-bar at the top of the control displays various properties of the the script: The position of the edit-cursor, the edit-status of the script, the run-status of the script and the name of worksheet and the workbook containing the script.
Click on the left-hand margin of the editor to set or remove the break-points in your script. Each break-point is indicated by a red circle in the margin. You can set breakpoints in your script when it is not running or when it is stopped at a breakpoint.
Right-click in the edit control to display its "pop-up" menu. The menu options allow you to cut, copy, paste and find text and to undo/redo any changes to your script. The standard short-cut keys for cut, copy, paste and find can also be used.
The scripts you create are saved as a cell "comment" in the active worksheet. If you create a new script or change an existing script then, when you close the workbook containing this script, you will be prompted by Excel to save the workbook. You must save this workbook in order to save your script.

Click on the buttons to the right of the editor to run and debug your script.
If the script runs without error, then a message-box will be displayed that allows you to either view the output workbook immediately (select NO) or to rename and save the workbook before viewing it (select YES).
Rename or save Excel workbook
When the script has run to completion or is stopped at an execution break-point, you may select a "tab" to display the watch page and examine the current value of variables or expressions, or the output page to show the result of the script's execution,
When script execution has paused at a break-point or while stepping, you may set and clear break-points and then continue script execution using any of the active buttons on the left hand side of the page, but you may not edit the script.

Click on the tabs at the bottom of this form to switch between pages in the bottom panel that allow you to:

This page allows you to view help for L4X. Click on the tabs at the top of this page to select help for the the L4X editor/debugger and the L4X language.

The input-text control on this page, displays pages of text from the file you have selected for import. You can use the mouse to position on or select areas of text in this control. When you have selected text, the position, dimensions and contents of the selection may be used by a wizard button to build a valid L4X expression.
Use the [Open] button to show a dialog-box which allows you to select the text-file to be imported. This dialog-box allows you to select files of type: AS400/ISeries spooled-file, HP PCL, Adobe PDF and ASCII Text. You may also select a text-file for import by dragging a file and then dropping it onto the text control.
Use the [Export] button to show a dialog-box which allows you to save the (converted) text-file as plain ASCII text.
Right-click in the input-text control to display its "pop-up" menu. The menu options allow you to copy and find text. The standard short-cut keys for copy and find can also be used.
The status-bar at the bottom of the text control displays the text line(s) and position(s) you have moved to or selected. The status bar also shows the page-number of the spooled-file that is currently visible and the arrow buttons allow you to page through the text.

On the left of the Input page there are buttons, captioned by the L4X expression that this particular button will build.
Please select text within the input text control (to the right of these wizard buttons) before clicking a button, as the field and parameter values in the expression created by the wizard are based on the positions, dimensions and content of the selected text. Then, when you click on a button, the corresponding expression is built and copied to the edit control.
help for help tab Click on the "question-mark" icon, to the right of each "wizard" button, to display help for the expression built by the button.

Enter the variable name or expression in the first column of this grid control, then click the [Eval] button (or F5) to evaluate the expression and display its result in the second column. For example, during the execution of an event function, you can see the contents of a particular line of text within the open text-file by entering:
When you refresh the watches, the right-hand cell will show the text of the selected line. If you want to see a sub-string of a line of input text, then enter the following expression:
strsub(Page.texts[5], 1, 21)
When you refresh the watches, the right-hand cell will show 21 characters of text from the selected line, beginning at the first character in the line.
Please note, if you evaluate expressions when the script is stopped outside of a L4X event function you should prefix each table name with the name of the "reserved" table Sheet, so the first example above should be entered as:
The buttons on the left of this control allow you to re-evaluate the values for all expressions entered in the grid, to add a line to the grid and to remove the last or a selected line.

This control displays the result of running a script, that is, any error messages and/or the output of any print( ) function that has executed. If the error-message contains a line-number, like "line n", you may click on this line to re-position the cursor within the edit control.
When a worksheet has been generated, the buttons on the left of this page are enabled:
  • Use the [Show] button to show the worksheet that has just been created.

  • Use the [Save] button to open a dialog-box that allows you to save the worksheet, before it is shown.

This page allows you to enter parameters that control how text is imported.

This document ©Jane Hearn 2009.
All Microsoft trademarks acknowledged.