Create a table in the current sheet, acdbtable class

Source: Internet
Author: User
Tags visibility

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.