DynaPDF Manual - Page 403

Previous Page 402   Index   Next Page 404

Function Reference
Page 403 of 839
SI32 valLen;
char* src, *value = NULL;
// aField must be a handle of list box in this example
valLen = pdfGetFieldExpValue(pdf, aField, value);
SI32 len = strlen(value); // Get the string length
if (valLen > 0 && len < valLen)
src = value;
fwrite(src, 1, len, f);
fwrite("\r\n", 1, 2, f);
src += (len +1);
// Skip over the null-terminator
// This can not cause a buffer overrun because of the two
// null-terminators at the end of the string.
len = strlen(src);
If the string length that was returned by the standard C function strlen() is shorter than the length
that was returned by GetFieldExpValue(), multiple values are selected in the list box.
The code above writes the values to a file and adds an EOL after each value. This is just an example
to see how the string can be parsed.
The export values of check boxes and combo boxes are not terminated with two null-terminators.
Try to parse the export value only if the field is a list box. The field type can be determined with the
functions GetFieldType(), GetFieldEx() or GetPageFieldEx().
Return values:
If the function succeeds the return value is the string length excluding the last null-terminator(s). If
the function fails the return value is a negative error code.
SI32 pdfGetFieldExpValueEx(
const PPDF* IPDF,
// Instance pointer
UI32 AField,
// Field handle
UI32 ValIndex,
// Value index
char* ADDR Value,
// Index value
char* ADDR ExpValue, // Index export value
LBOOL ADDR Selected) // Is the value selected?

Previous topic: GetFieldExpValCount, GetFieldExpValue

Next topic: GetFieldFlags