Using Wildfire 4.0 M220:
I’m attempting to use J-Link to modify text properties in an existing drawing table. I have a method goes through the rows and columns to adjust the text height, width, etc. Everything works, but the text height varies from the given value.
In a nutshell, here is how I’m doing it:
In a loop through rows and columns in a table row (removed error checking to make it easier to read):
cell = pfcTable.TableCell_Create(rowNum, colNum);
cellNote = (DetailNoteItem) tbl.GetCellNote(cell);
noteInstr = cellNote.GetInstructions(true);
textLines = noteInstr.GetTextLines();
numLines = textLines.getarraysize();
for (int i = 0 ; i < numLines ; i++)
{
line = textLines.get(i);
texts = line.GetTexts();
numTexts = texts.getarraysize();
for (int j = 0 ; j < numTexts ; j++)
{
txt = texts.get(j);
txt.SetTextHeight(3.0);
txt.SetTextWidthFactor(0.8);
}
line.SetTexts(texts);
}
noteInstr.SetTextLines(textLines);
noteInstr.SetHorizontal(HorizontalJustification.H_JUSTIFY_CENTER);
noteInstr.SetVertical(VerticalJustification.V_JUSTIFY_MIDDLE);
cellNote.Modify(noteInstr);
This works - it changes the height, but not to the specified value. It depends on the sheet size… On an A0 sheet, the table text ends up larger than the 3.0 specified in SetTextHeight(). As the sheet size gets smaller, the resulting textheight issmaller.This is on a drawing that has no model, and the table has no repeat regions or parameters.
I thought maybe it’s related to the background view, so I tried this:
double viewScale = 1.0;
View2D vw = currDrw.GetSheetBackgroundView(shtNum);
if (vw != null) viewScale = vw.GetScale();
No luck… the GetScale() call throws XToolkitGeneralError.
Am I overlooking something?
Thanks,
Dan
I figured it out. I just had to get the sheet transformation matrix and use it to transform the text height value.
Dan
Hi, try this to correct text size:
double Matrix = drawing.GetSheetTransform(1).GetMatrix().get(0,0);
double TextSize=3/Matrix;
txt.SetTextHeight(TextSize);