Load and Save Category (Formatstrings)

[Top]  [Chapter]  [Previous]  [Next]

Methods to load and save the text as file, stream or string.

Description

TextDynamic contains various methods to load and save text. Most of these methods require a second parameter, the "format string". This string first contains the required format RTF, ANSI, HTML, WPT, UNICODE, MIME and then options for the reader or writer.

 

New: Before the format name it is now possible to specify the name of a merge field or other paired objects. The syntax is X:text=.

X can be one of this letters:

lowercase letters:

      c: search for wpobjCustom comparing the object name = text

      f: search for wpobjMergeField

      h: search for wpobjHyperlink

      b: search for wpobjBookmark

      p: search for wpobjTextProtection

      s: search for wpobjSPANStyle

capital letters:

      C: search for wpobjCustom comparing the object source parameter = text

      F: search for wpobjMergeField etc.

If the objects are not found nothing will be loaded or saved.

 

 

 

 

Properties

 


Methods

 

 

 

When you work with a data bound editor you need to use TextCursor.CheckState(10) to trigger the PropChanged event at first chance before any code which updates the text.

 

For XML and HTML Format please also see chapter "HTML/E-MAIL loading and saving" in the manual.

 

If you want to display a split editor with the HTML source (HTML code) and formatted text you can use TextCommandStr(5, ..) .

 

 

Many methods which save text also use a boolean value to toggle between saving the complete text/selection only.

 

The loading methods also use a parameter to select the insert at "cursor position" mode.

 

Please also note that it is possible to load inside a paragraph or cell, and it is also possible to load the text into the "data block" which represents a header, footer, text box or footnote.

 

If you load and save to a blob field we recommend to use GetTextVar / SetTextVar. This works much faster than using strings and avoids problems which are caused by unicode compression. GetTextVar can be also used to read the binary data which should be used for an ASP Response.

 

When using streams in .NET applications you need the Stream2WPStream utility class. It needs to be created for each load and save operation.

 

System.IO.Stream str = new System.IO.MemoryStream();

Memo.SaveToStream( new WPDynamic.Stream2WPStream(str) ,false,"RTF");

str.Position = 0;

Memo.LoadFromStream(new WPDynamic.Stream2WPStream(str), true, "AUTO");

 

List of options possible in a "format string":

 

 

Option "-..."

What it does

RTF

READ

RTF

WRITE

HTML

READ

HTML

WRITE

WPT

READ

WPT

WRITE

ANSI

*.txt

UNICODE

MIME

*.msg

 

codepage12xx

set the code page XY for loading. Default is 1252

X

 

X

 

 

 

X

 

 

 

utf8

The HTML reader will detect UTF8 characters

 

 

X

 

 

 

 

 

 

 

onlybody

only load/write body part (no header + footer)

 

X

 

X

X

X

 

 

 

 

ignorefonts

do not load font information

X

 

 

 

X

 

 

 

 

 

ignorefontsize

do not load font size information

X

 

 

 

X

 

 

 

 

 

nostyles

do not load or save styles

X

X

 

 

X

X

 

 

 

 

nonumstyles

do not load or save number styles

X

X

 

 

X

X

 

 

 

 

noimages

do not load or save images

X

X

X

 

X

X

 

 

 

 

basetext

only save text in WPTOOLS format, no styles or other info

 

 

 

 

 

 

 

 

 

 

nomergefields

do not save merge fields, only contents

 

 

 

 

 

 

 

 

 

 

nohyperlinks

do not save hyperlinks

 

 

 

 

 

 

 

 

 

 

nobookmarks

don't save bookmarks

 

 

 

 

 

 

 

 

 

 

novariables

dont save or load "RTFVariables" (also known as "Document Properties")

X

X

 

 

 

X

 

 

 

 

nobinary

try to convert all binary to ASCII

 

X

 

 

 

 

 

 

 

 

nopageinfo

do not save or load page size information

 

X

 

 

X

X

 

 

 

 

ignorekeepn

don't load the keepn flag from RTF

X

X

 

 

X

X

 

 

 

 

ignorerowmerge

do not load row merging from RTF

X

 

 

 

 

 

 

 

 

 

ignorecollapsedpar

don't save table rows which are hidden by WPReporter

 

X

 

 

 

 

 

 

 

 

dontaddrtfvariables

only load those content of RTF variables which are present in collection

X

 

 

 

X

 

 

 

 

 

complete

load header and footer information although we are inserting text

 

 

 

 

 

 

 

 

 

 

alwaysembed

embed image data also for linked images

 

 

 

 

 

 

 

 

 

 

nonumberprops

the numbering will be saved as normal text. Number styles will not

be saved either.

 

X

 

 

 

 

 

 

 

 

nospanstyles

span styles will not be saved as objects -only the properties will be saved.

 

X

 

 

 

 

 

 

 

 

nocharstyles

don't write character styles (\cs)

 

X

 

 

 

 

 

 

 

 

ignorerowmerge

If this flag is set the rowmerge property will be ignored when reading RTF code.

X

 

 

 

 

 

 

 

 

 

dontfixattr

If this property is true the RTF reader will not remove redundant attribute information, such as fonts, indents etc. Redundant are attributes which are selected by the paragraph styles or document font information (DefaultTextAttr).

X

 

 

 

 

 

 

 

 

 

ignorerowheight

Do not load and apply the absolute row height defined in RTF code.

X

 

 

 

 

 

 

 

 

 

onlyusedstyles

If this property is TRUE the RTF reader will only add the styles which are used.

X

 

 

 

 

 

 

 

 

 

onlystandardheadfoot

If this property is true the RTF writer will not save header and footer texts which

rage is not defined by the RTF specifications, such as 'on last page'.

 

X

 

 

 

 

 

 

 

 

NoStartTags

The RTF and HTML writer do not create the standard RTF and HTML opening and closing sequence

 

X

 

 

 

 

 

 

 

 

abbreviated

The WPTOOLS writer created abbreviated property codes

 

 

 

 

 

X

 

 

 

 

nosectiondata

The WPTOOLS writer does not write section information

 

 

 

 

 

X

 

 

 

 

ignorehtml

If this property is true the HTML reader will not use HTML tags. This is useful if also

useBBCodes is used.

 

 

X

 

 

 

 

 

 

 

usebbcodes

If this property is tre the HTML will convert BB codes into HTML properties

 

 

X

 

 

 

 

 

 

 

nospanobjects

This property is true SPAN tags will not be embedded.

 

 

X

 

 

 

 

 

 

 

usecr

If this property is true CR codes in the HTML text will be used as paragraph breaks

 

 

X

 

 

 

 

 

 

 

imgpath="..."

Specify the path where to create linked files

(default = "\" which is the current directory)

 

 

 

X

 

 

 

 

 


csspath="..."

Specify the location of a CSS file which is used instead of the one linked by the HTML code when reading. When writing the respective link will be written.

 

 

X

X

 

 

 

 

 


dontwritestyleparam

Do not write the style="" parameter in HTML code. This creates simplified HTML code.

 

 

 

X

 

 

 

 

 


writeallcolwidth

Write the column width for all table columns

 

 

 

X

 

 

 

 

 


writebasefont

Write a basefont tag using the information of the default attributes of the document

 

 

 

X

 

 

 

 

 


writespan

Write <span> objects instead of <font>

 

 

 

X

 

 

 

 

 


littleendian

Write little endian unicode file

 

 

 

 

 

 

 

X

 


nohtml

do not save HTML text

 

 

 

 

 

 

 

 

X


noplain

do not save PLAIN text

 

 

 

 

 

 

 

 

X


readprintpar

the paper source in in IWPPrintParameter will be loaded from RTF

X

 

 

 

 

 

 

 

 

 

 

 


[idh_cat_io.htm]    Copyright © 2007 by WPCubed GmbH