Table cell text bold

Table cell text bold

stefan.hofer
Advocate Advocate
3,293 Views
5 Replies
Message 1 of 6

Table cell text bold

stefan.hofer
Advocate
Advocate

I have my Table:

AcadTable acTable = new AcadTable();
acTable = thisDrawing.PaperSpace.AddTable(insertPoint, rows, columns, defaultRowHeight, defaultColumnWidth);
acTable.SetTextHeight((int)AcRowType.acTitleRow, 3);
acTable.SetTextHeight((int)AcRowType.acHeaderRow, 2);
acTable.SetTextHeight((int)AcRowType.acDataRow, 2);
acTable.SetTextStyle((int)AcRowType.acTitleRow, "Arial");
acTable.SetTextStyle((int)AcRowType.acHeaderRow, "Arial");
acTable.SetTextStyle((int)AcRowType.acDataRow, "Arial");
acTable.RowHeight = defaultRowHeight;
acTable.Layer = "0";

 

and can change the text color:

acTable.SetCellContentColor(currentRow, currentColumn, (AcadAcCmColor)myColor);

 

How can i make the text from a cell or column BOLD ?

 

 

 

 

0 Likes
Accepted solutions (2)
3,294 Views
5 Replies
Replies (5)
Message 2 of 6

_gile
Consultant
Consultant
Accepted solution

Hi,

 

It seems to me you're using the COM/ActiveX API, so all available methods for the AcadTable object ar described >>here<<.

As far as I know, the only way is to force the mtext using format code (see >>here<<😞

acTable.SetTextString(currentRow, currentColumn, 0, "{\\fArial|b1|i0;Your text here);

 



Gilles Chanteau
Programmation AutoCAD LISP/.NET
GileCAD
GitHub

Message 3 of 6

_Tharwat
Advisor
Advisor
Accepted solution

Hi,

Maybe one solution is to wrap the string with the bold codes like this:

"{\\fArial|b1|i0|c0|p34;" MyString "}"
Message 4 of 6

stefan.hofer
Advocate
Advocate

I tried this:

 

string myString = "BoldText";
acTable.SetTextString(currentRow, currentColumn, 0, "{\\fArial|b1|i0|c0|p34;" + myString + "}");
//and
acTable.SetText(currentRow, currentColumn, "{\\fArial|b1|i0|c0|p34;" + myString + "}");
//and
acTable.SetCellValue(currentRow, currentColumn, "{\\fArial|b1|i0|c0|p34;" + myString + "}");

 

all give me no bold text. It's the normal arial font like in all other cells.

0 Likes
Message 5 of 6

stefan.hofer
Advocate
Advocate

Forget my last post, it works fine.

I changed the wrong part in my code....

 

thank you!

0 Likes
Message 6 of 6

_gile
Consultant
Consultant

This works for me:

string yourString = "NormalText";
acTable.SetTextString(currentRow, currentColumn, 0, yourString);
currentRow++;
yourString = "BoldText";
acTable.SetTextString(currentRow, currentColumn, 0, "{\\fArial|b1|c0;" + yourString + "}");

bold.png



Gilles Chanteau
Programmation AutoCAD LISP/.NET
GileCAD
GitHub