Function : Item Conversion

ConvertItemToText - Convert composite or text item to character text.
----------------------------------------------------------------------------------------------------------

#include <ods.h>

STATUS LNPUBLIC ConvertItemToText(
BLOCKID ItemValue,
DWORD ItemValueLength,
const char far *LineDelimiter,
WORD CharsPerLine,
DHANDLE far *rethBuffer,
DWORD far *retBufferLength,
BOOL fStripTabs);

Description :

This function formats an item of either TYPE_COMPOSITE or TYPE_TEXT into a character text buffer. It takes as input a composite or text item, its length, number of characters desired per output line, the desired output line delimiter(s), and whether or not tabs should be stripped. The function returns as output a buffer containing character text and embedded "new line" characters and also returns the length of the text buffer.

If line_delimiter = "", then each output line in the returned text buffer would end in '\0'. Note: a '\0' anywhere in an item of TYPE_TEXT forces Notes to display a new line. If line_delimiter = "\r\n", then each output line would end with a return-newline pair.

Note: Some degree of experimentation with the original Rich Text is required, before you can be assured that its basic appearance (tabs and line lengths) will be maintained during the conversion. If there are embedded tabs in the original item, their contribution to the converted line length is always taken as eight (8) spaces. Example: The original Rich Text may be setup with tabs at .5" intervals(about 4 spaces for 8 point plain Courier), but their value in equivalent spaces is ignored. If there are 4 tabs embedded in a line of Rich Text, they will account for 32 characters in the output line length calculation.

This function is very useful in E-Mail Gateways where Domino Rich Text must be converted to plain character text. It can also be used to reformat existing Domino Text Items to new margins and/or to strip tabs from the item.

Note: the returned buffer must be deallocated by the caller via OSMemFree().

Parameters :

Sample Usage :


  /* Convert the Object associated with the BID to a plain text  */
  /* buffer. ConvertItemToText throws away CD Records that don't */
  /* map to text: Document Links, DDE Links, Graphics, etc.      */

 if (Error_Status = ConvertItemToText (bidTmpCD, TmpCDLen,
                                       LineDelimiter, CharsPerLine,
                                       &hExpBuffer, &ExpBufferLength,
                                       fStripTabs))
  {
      goto Exit;
  }
  else
      CleanUp_State += FREE_EXPBUFFER;


See Also :

ConvertItemToCompositeExt
----------------------------------------------------------------------------------------------------------