.NET
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Create a table with no title/header rows??

15 REPLIES 15
Reply
Message 1 of 16
Anonymous
3109 Views, 15 Replies

Create a table with no title/header rows??

I'm trying to create a simple table with no title or header rows, only data rows. 

 

First i tried IsTitleSuppressed & IsHeaderSuppressed, but those give me a warning message saying they "are obsolete, use Cell Functionality instead"

 

Ok, not entirely sure what they mean by "cell functionality" so i tried the method listed here - http://through-the-interface.typepad.com/through_the_interface/2011/11/handling-protocol-changes-to-...

"Next we have the third set of warnings, which relate to suppression of the title and header rows. These are also at the Cell level, but are also a bit tricky to get access to. You need to get the Cells for the row (passing in the row number and -1, for the column) and get/set the Style property. This string property should contain “Title” for title rows and “Header” for header rows. If you want to suppress the title – the equivalent of Table.IsTitleSuppressed = true), you can search through for the row containing “Title” in its Style property, and set it to the empty string (“”). And the equivalent operation for the header row."

 

That doesn't work either. If i set it to an empty string nothing changes and if i set the string to "Data" I get an error saying "eNotApplicable". I also tried setting myTable.Rows[1].Style, that didn't work either. Can i get some help here please? I've spent hours on this already and I still haven't been able to get it to work. Thank you. 

15 REPLIES 15
Message 2 of 16
_Tharwat
in reply to: Anonymous

Hi,

Did you try the method mergecells before?

Message 3 of 16
Anonymous
in reply to: _Tharwat

No, I didn't think that merging would be relevant. How would one go about this? Merge the entire row and then set the style after merging?
Message 4 of 16
_Tharwat
in reply to: Anonymous

eg:

                    CellRange range = CellRange.Create(tbl, 0, 0, 0, 2);
                    tbl.MergeCells(range);

Where tbl is the table object and 2 is the number of columns.

 

Try it and let me know.

Message 5 of 16
fieldguy
in reply to: Anonymous

This might also work.

mytable.Rows[i].Style = "Data";

Message 6 of 16
Anonymous
in reply to: _Tharwat


@_Tharwatwrote:

eg:

                    CellRange range = CellRange.Create(tbl, 0, 0, 0, 2);
                    tbl.MergeCells(range);

Where tbl is the table object and 2 is the number of columns.

 

Try it and let me know.


 

 

I tried it but nothing seems to have changed. The first line of the table is still Title and the second line is Header. After that I tried changing range.Style and that doesn't seem to work either.

Message 7 of 16
_Tharwat
in reply to: Anonymous

Sorry for the confusion but you need unmergecells and not mergecells. 

Message 8 of 16
Anonymous
in reply to: fieldguy


@fieldguywrote:

This might also work.

mytable.Rows[i].Style = "Data";


Error "eNotApplicable" Smiley Sad

Message 9 of 16
Anonymous
in reply to: _Tharwat


@_Tharwatwrote:

Sorry for the confusion but you need unmergecells and not mergecells. 


Still doesn't seem to be doing anything. Am i supposed to set Style after unmerging?

Message 10 of 16
fieldguy
in reply to: Anonymous

Sorry - after re-reading I see in your 1st post you tried  mytable.Rows[i].Style = "Data".

I also use mergecells (not unmerge) and it occurs after setting the style.

 

I remember finding quite a few samples in the web but I didn't save the urls.  Have you seen >>this<<?  

Message 11 of 16

Hi,

 

Please try tab.Rows[0].Style = "_DATA";

 



Virupaksha Aithal KM
Developer Technical Services
Autodesk Developer Network

Message 12 of 16
Anonymous
in reply to: Virupaksha_aithal


@Virupaksha_aithalwrote:

Hi,

 

Please try tab.Rows[0].Style = "_DATA";

 


I'm still getting error "eNotApplicable" when I try to do this. 

Message 13 of 16
Anonymous
in reply to: fieldguy


@fieldguywrote:

Sorry - after re-reading I see in your 1st post you tried  mytable.Rows[i].Style = "Data".

I also use mergecells (not unmerge) and it occurs after setting the style.

 

I remember finding quite a few samples in the web but I didn't save the urls.  Have you seen >>this<<?  


Hmm thanks for the link. I was trying to use the standard table style instead of creating a new one from scratch but I'm out of ideas at this point. I'll give that a try this weekend.

 

It would be really nice if there was a simple option for this like IsTitleSuppressed & IsHeaderSuppressed though, or at least some better documentation from Autodesk on how we're supposed to do this without those.

Message 14 of 16
Civil3DReminders_com
in reply to: Anonymous

Looks like the table style needs to be set before setting the individual row or cell style. 

tble.TableStyle = tblStyle.ObjectId;

I came here via Google and I suspect I'd be back here again in the future when I copy code from one project to another and neglect to copy over all of the code, hence this comment on this old post. 

 

It looks like all of the other suggestions are correct and didn't notice the table style wasn't being set first.

 

 

Civil Reminders
http://blog.civil3dreminders.com/
http://www.CivilReminders.com/
Alumni
Message 15 of 16
sophia_lee
in reply to: Anonymous

sophia_lee_0-1721006496671.png

When creating a table, change the first row cell and second row cell style to data, then it won't create a table with header or title. hope this helped! thanks


Sophia Lee
Global Product Support Specialist
Message 16 of 16

I think the original poster is asking about how to do this in code, not through the user interface.

 

BTW, going through the UI, one must also change the height of the first row.

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

AutoCAD Inside the Factory


Autodesk Design & Make Report