Table Example Study notes
In this example, Arx shows us some basic operating methods of the Acdbtable class, Acdbtable class is ACAD2005 and later products, it should be said acdbdatatable upgrade products, Acdbdatacell, Acdbdatatable,acdbdatacolumn has appeared in the ACAD2004.
The acdbtable feature is very powerful. From the most basic, can set the table row, column number, row, column height (nonsense, this is the most basic), but also can set the text style, each cell's front, background color, text line width, text visibility, text rotation.
The style, color, line width, and visibility of the table line.
You can also set automatic scaling.
Merges and splits cells.
Select a sub-region (which is part of the selection);
There are also a series of actions, such as grips for custom entities, that are really powerful.
Here is the simplest example of creating a table.
Acdbblocktable *pblktbl;
Acdbhostapplicationservices ()->workingdatabase ()->getblocktable (PBLKTBL, acdb::kforwrite);
Get block table records for model space
Acdbblocktablerecord *PBLKTBLRCD;
Pblktbl->getat (Acdb_model_space, pblktblrcd,acdb::kforwrite);
acdbtable* ptable = new Acdbtable;
Acdbdictionary *pdict = NULL;
Acdbobjectid Idtblstyle;
Acdbhostapplicationservices ()->workingdatabase ()->gettablestyledictionary (PDict,AcDb::kForRead);
Pdict->getat (_t ("standard"), Idtblstyle);
Pdict->close ();
Ptable->settablestyle (Idtblstyle);
acdbtextstyletable* Ptextstyle = NULL;
Acdbhostapplicationservices ()->workingdatabase ()->gettextstyletable (Ptextstyle,acdb::kforread);
Acdbobjectid Textid;
Ptextstyle->getat (_t ("standard"), Textid);
Ptextstyle->close ();
if (!textid.isnull ())
{
Ptable->settextstyle (Textid);
}
Ptable->setnumcolumns (2);
Ptable->setnumrows (4);
Ptable->generatelayout ();
Ptable->suppressheaderrow (false);//Disable Caption
Defining the insertion point
Ptable->setposition (Acgepoint3d (100,100, 0));
Define Row Heights
Ptable->setrowheight (0,30);
Ptable->setrowheight (1,5);
Ptable->setrowheight (2,5);
Ptable->setrowheight (3,5);
Defining column widths
Ptable->setcolumnwidth (0,45);
Ptable->setcolumnwidth (1,40);
Ptable->settextstring (1,1,_t ("SFSFSDFSD"));
Ptable->setautoscale (1,1,true);
Pblktblrcd->appendacdbentity (ptable);
Ptable->setregen ();
Ptable->close ();
Pblktblrcd->close ();
Pblktbl->close ();
Refresh Screen
Actrtransactionmanager->flushgraphics (); /*refresh screen*/
Acedupdatedisplay ();
Create a table in the current sheet, acdbtable class