Saving a tab formatted field to a file and retaining its formatting
Richard Gaskin
ambassador at fourthworld.com
Mon Apr 8 11:56:22 EDT 2019
Robert J. Earp wrote:
> Dear all, we have a field that is formatted nicely with tabs and want
> to save that as a file, retaining the tab formatting. The saved file
> format ideally should be .rtf but we may be able to use other formats
> such as .pdf
>
> Anybody got any ideas how to do this ?
Short answer: Not directly just yet, but with RTF being a text format
you could write a function to add column widths to RTF on export.
Longer answer:
Exporting the contents of a field does not export the properties of a
field object itself. But with the enhancements of v5.4 we now have MANY
more paragraph-level properties.
So we would expect that setting the tabStops (or the newer tabWidths,
sometimes a more useful alternative) of each line within the field would
produce rtFText that includes those column specifiers.
But alas, I just tried it and it does not.
If someone has time to catalog those RTF features that LC now supports
with fields but does not include in rtfText it may be helpful to file an
enhancement request to bring rtfText current with the full range of
relevant text properties.
RtfText is not designed to be able to reproduce an LC field with
complete fidelity (that's htmlText's role), but should include all
attributes common to both LC and RTF, and AFAIK did cover almost all of
them until v5.4 introduced all the new paragraph and inline styling
properties.
For now, a workaround would be to write a function that walks through
the rows and columns of a field, including column width specifiers as
you go. Tedious, but doable.
--
Richard Gaskin
Fourth World Systems
Software Design and Development for the Desktop, Mobile, and the Web
____________________________________________________________________
Ambassador at FourthWorld.com http://www.FourthWorld.com
More information about the use-livecode
mailing list