Dear Experts.
I am having a document file which contains a word file (IMPORTED). The File is having a lot of Tables inside it. What i am trying to do is i want to change the FONT and TEXT SIZE of content inside the TABLE. Please see the below Code what i have written so far. Since i am new to FM Scripting i am facing few issues in my code. Please guide me to solve this issue.
#target framemaker
main ();
function main () {
var doc = app.ActiveDoc;
if (doc.ObjectValid () === 1) {
processDoc (doc);
}
else {
alert ("There is no active doc.");
}
}
function processDoc (doc) {
var tbl = doc.FirstTblInDoc;
while (tbl.ObjectValid () ) {
var text = tbl.GetText(Constants.FTI_String) ;
var text1 = new TextRange() ;
text1.beg.obj = text1.end.obj = text ;
applyFontToTbl(text_range)
}
tbl = tbl.NextTblInDoc;
doc.Redisplay ();
}
applyFontToTbl(text_range, "Calibri");
function applyFontToTbl(text_range, fontName)
{
var fontFamilyNames = app.FontFamilyNames;
for(var i = 0; i < fontFamilyNames.length; i++)
{
if(fontFamilyNames[i] == fontName) break;
}
if(i == fontFamilyNames.length)
{
alert("Could not find the specified font, " + fontName);
return;
}
props = AllocatePropVals(1);
props[0].propIdent.num = Constants.FP_FontFamily;
props[0].propVal.valType = Constants.FT_Integer;
props[0].propVal.ival = i;
}
With RegardsAghil.M