J
Joseph M. Newcomer
I want to iterate over all the lines in a text object, specifically, exactly the number of
lines in a text object. I have not discovered how to tell how many lines I have. Looking
for an "empty" line won't work because there are instances of empty lines.
I'm doing this through the Automation Interface from another program, so here's the code
//*****************************************************
// Handle indexing items in the Notes page
//*****************************************************
CSlideRange sliderange = slide.get_NotesPage();
CShapes shapes = sliderange.get_Shapes();
CPlaceholders placeholders = shapes.get_Placeholders();
CShape shape = placeholders.Item(2);
CTextFrame frame = shape.get_TextFrame();
if(frame.get_HasText())
{ /* text in frame */
CTextRange textrange = frame.get_TextRange();
int linecount = textrange.get_Count();
// ^^^^^ this line is clearly wrong, it was a guess
for(int i = 1; i <= linecount; i++)
{ /* scan lines */
int slideno;
slideno = slide.get_SlideNumber();
CTextRange lines = textrange.Lines(i, 1);
CString L = lines.get_Text();
if(L.GetLength() > 1 && L[0] == _T('*'))
{ /* maybe keyword */
TRACE(_T("[%d] \"%s\"\n"), slideno, L);
} /* maybe keyword */
} /* scan lines */
} /* text in frame */
The goal here is to identify all lines that start with * as being candidates for some
further analysis, represented here by the TRACE statement (I haven't written that code
yet)
Also, the explanation about how "removing the slide image" means I should use
placeholders(1) instead of placeholders(2) [chapter 6 of the Office 97 book on the Web at
http://msdn.microsoft.com/archive/en_us/office97/html/006.asp
is missing a lot, such as what is the slide image, how do I know it has been removed, and
how do I know whether I should use (1) or (2)?
joe
Joseph M. Newcomer [MVP]
email: (e-mail address removed)
Web: http://www.flounder.com
MVP Tips: http://www.flounder.com/mvp_tips.htm
lines in a text object. I have not discovered how to tell how many lines I have. Looking
for an "empty" line won't work because there are instances of empty lines.
I'm doing this through the Automation Interface from another program, so here's the code
//*****************************************************
// Handle indexing items in the Notes page
//*****************************************************
CSlideRange sliderange = slide.get_NotesPage();
CShapes shapes = sliderange.get_Shapes();
CPlaceholders placeholders = shapes.get_Placeholders();
CShape shape = placeholders.Item(2);
CTextFrame frame = shape.get_TextFrame();
if(frame.get_HasText())
{ /* text in frame */
CTextRange textrange = frame.get_TextRange();
int linecount = textrange.get_Count();
// ^^^^^ this line is clearly wrong, it was a guess
for(int i = 1; i <= linecount; i++)
{ /* scan lines */
int slideno;
slideno = slide.get_SlideNumber();
CTextRange lines = textrange.Lines(i, 1);
CString L = lines.get_Text();
if(L.GetLength() > 1 && L[0] == _T('*'))
{ /* maybe keyword */
TRACE(_T("[%d] \"%s\"\n"), slideno, L);
} /* maybe keyword */
} /* scan lines */
} /* text in frame */
The goal here is to identify all lines that start with * as being candidates for some
further analysis, represented here by the TRACE statement (I haven't written that code
yet)
Also, the explanation about how "removing the slide image" means I should use
placeholders(1) instead of placeholders(2) [chapter 6 of the Office 97 book on the Web at
http://msdn.microsoft.com/archive/en_us/office97/html/006.asp
is missing a lot, such as what is the slide image, how do I know it has been removed, and
how do I know whether I should use (1) or (2)?
joe
Joseph M. Newcomer [MVP]
email: (e-mail address removed)
Web: http://www.flounder.com
MVP Tips: http://www.flounder.com/mvp_tips.htm