I have created a configuration module which consists of plain text, bolded text, and italic text.
void dumpAllInfo(RichText rt)
{
print "***********New chunk:\n"
print "text:" rt.text ": "
print "bold:" rt.bold ": "
print "italic:" rt.italic ": "
print "underline:" rt.underline ":\n"
print "strikethru:" rt.strikethru ": "
print "superscript:" rt.superscript ": "
print "subscript:" rt.subscript ": "
print "charset:" rt.charset ":\n"
print "newline:" rt.newline ": "
print "last:" rt.last ":\n"
// new in 6.0
print "isOle:" rt.isOle ": "
print "indent:" rt.indentLevel ": "
print "bullet:" rt.isBullet ": "
print "bulletStyle:" rt.bulletStyle ": "
print "isUrl:" rt.isUrl ":\n"
}
void dumpAllParagraphs(string s)
{
RichTextParagraph rp
RichText rt
for rp in s do
{
print "****New paragraph\n"
print "text:" rp.text ":\n "
print "indent:" rp.indentLevel ": "
print "bullet:" rp.isBullet ":\n"
print "bulletStyle:" rp.bulletStyle ":\n"
for rt in rp do
{
dumpAllInfo rt
}
}
}
string GetTemplate()
{
// read in configuration module which contains mixture of Bold and italic text.
mTemplate = read(strReviewTemplate,false)
string strOHead
int nHeaderType = 0
string strObjectText
string strTemp
Module mTemplate
Object oTemplate
for oTemplate in mTemplate do
{
strOHead = oTemplate."Object Heading"
if (nHeaderType == 1)
{
strObjectText = richText oTemplate."Object Text"
} // end if (nHeaderType == 1)
if (strOHead == "Review") // read current header
{
nHeaderType = 1
} // end if (strOHead == "Review") // read current header
} // end for o in mTemplate do
//Calling dumpAllParagraphs shows the correct text that should be bold, as well as italic.
dumpAllParagraphs(strObjectText
return(strObjectText)
} // GetTemplate()
//main
Module m
Object o
for o in m do
{
...
//When the word Review is found in a header, call GetTemplate
string strCombo = GetTemplate()
o."Object Text" = strCombo
break
// copied data does not appear as expected
}
Gedinfo - Fri Mar 15 16:56:32 EDT 2013 |
Re: Use DXL to copy Bold/Italic text from one module to another issue
-Louie On other news... [] GetTemplate() seems odd to me. Once you find a "Review" heading, then you get (and dump) the Object text of all the rest of the objects. I notice that "stObjecText" houses only the LAST object in the module, and you return that value. That one value is set to every object in the orignal module. I wonder if line 54:
I wonder also if you should instead do this at line 54:
[] I wonder if "GetTemplate" should accept a "Heading" string value, in this case "Review" and be coded to presume that it will retrieve the Objecgt Text that comes in the object AFTER that heading. Your bottom loop likewise would look for that same heading before calling GetTemplate. [] Seems to me that line 46:
[] You seem to be missing some code
[] Consider adding this function; then call it instead of printing all the values:
|
Re: Use DXL to copy Bold/Italic text from one module to another issue |