Saving a tab formatted field to a file and retaining its formatting

Ralph DiMola rdimola at evergreeninfo.net
Mon Apr 8 12:27:59 EDT 2019


No tabstops using the styledText property either. This is the one I would
have expected to include the tab stops/widths.

Ralph DiMola
IT Director
Evergreen Information Services
rdimola at evergreeninfo.net

-----Original Message-----
From: use-livecode [mailto:use-livecode-bounces at lists.runrev.com] On Behalf
Of Richard Gaskin via use-livecode
Sent: Monday, April 08, 2019 11:56 AM
To: use-livecode at lists.runrev.com
Cc: Richard Gaskin
Subject: Re: Saving a tab formatted field to a file and retaining its
formatting

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

_______________________________________________
use-livecode mailing list
use-livecode at lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode





More information about the use-livecode mailing list