Scott Crego
Usenet Archive
- Joined
- Jun 1, 2001
- Messages
- 10
- Reaction score
- 0
I have a problem with extracting text from a text node. I have set up the program as shown in many examples, wait for user to select an element with a text node, or in my case to select a cell.
I then step through the cell looking for all text and text nodes.
I then want to extract the text for putting in a Dialog box.
Here is the code that I am working with. The function I have tried is mdlText_extractStringsFromDscr.
I have looked all over the web and have found only a couple of references to this problem. Any help would be great.
Scott Crego
Private int extractdata /* <= returns info on what to do with element
*/
(
MSElementUnion *elementP, /* <=> element to be modified */ void *params, /* => user parameter */ int fileNum, /* => file # of current element */ MSElementDescr *elmDscrP, /* => element descriptor for element
*/
MSElementDescr **elmDscrPP /* <= if replacing entire descriptor
*/
)
MSElementDescr *tempEdP; /* traverses the element descriptor */ char string[256];
if (elementType == CELL_HEADER_ELM || elementType == SHARED_CELL_ELM) { tempEdP = elmDscrP->h.firstElem; strcpy(string, "");
while (tempEdP)
{
elementType = mdlElement_getType (&tempEdP->el);
if (elementType == TEXT_ELM)
{
mdlText_extractString (string, &tempEdP->el);
mdlText_expandString (string, string, sizeof (string), FRACTIONS | INTERNATIONAL);
fprintf(fp, "(%d) TEXT %s\n", counter, string);
}
if (elementType == TEXT_NODE_ELM)
{
holdEdP = tempEdP;
numnodes=tempEdP->el.text_node_2d.numstrngs;
//This is were it does do exactly what I want.
for (j=1; j<=numnodes; j++)
{
mdlText_extractStringsFromDscr (string, NULL, tempEdP); fprintf(fp, "TEXTNODE (%d of %d) (%s)\n", j, numnodes, string); tempEdP=tempEdP->h.next; counter++; } tempEdP=holdEdP; }
/* ----- point to the next element in the cell ----- */ tempEdP = tempEdP->h.next; } } return MODIFY_STATUS_NOCHANGE; }
I then step through the cell looking for all text and text nodes.
I then want to extract the text for putting in a Dialog box.
Here is the code that I am working with. The function I have tried is mdlText_extractStringsFromDscr.
I have looked all over the web and have found only a couple of references to this problem. Any help would be great.
Scott Crego
Private int extractdata /* <= returns info on what to do with element
*/
(
MSElementUnion *elementP, /* <=> element to be modified */ void *params, /* => user parameter */ int fileNum, /* => file # of current element */ MSElementDescr *elmDscrP, /* => element descriptor for element
*/
MSElementDescr **elmDscrPP /* <= if replacing entire descriptor
*/
)
MSElementDescr *tempEdP; /* traverses the element descriptor */ char string[256];
if (elementType == CELL_HEADER_ELM || elementType == SHARED_CELL_ELM) { tempEdP = elmDscrP->h.firstElem; strcpy(string, "");
while (tempEdP)
{
elementType = mdlElement_getType (&tempEdP->el);
if (elementType == TEXT_ELM)
{
mdlText_extractString (string, &tempEdP->el);
mdlText_expandString (string, string, sizeof (string), FRACTIONS | INTERNATIONAL);
fprintf(fp, "(%d) TEXT %s\n", counter, string);
}
if (elementType == TEXT_NODE_ELM)
{
holdEdP = tempEdP;
numnodes=tempEdP->el.text_node_2d.numstrngs;
//This is were it does do exactly what I want.
for (j=1; j<=numnodes; j++)
{
mdlText_extractStringsFromDscr (string, NULL, tempEdP); fprintf(fp, "TEXTNODE (%d of %d) (%s)\n", j, numnodes, string); tempEdP=tempEdP->h.next; counter++; } tempEdP=holdEdP; }
/* ----- point to the next element in the cell ----- */ tempEdP = tempEdP->h.next; } } return MODIFY_STATUS_NOCHANGE; }