Breaking a table?

Breaking a table?

Anonymous
Not applicable
1,934 Views
4 Replies
Message 1 of 5

Breaking a table?

Anonymous
Not applicable

My program generates a table and everything is working correctly. Now what I need to do is if the table exceeds a certain length i need to break it into two parts so it can be continued on the next page. I haven't been able to find any good examples online, i only found 2 previous threads so far where it was being discussed and so far their solution isn't working for me.

 

This is the relevant part of my code as of now -

 

            if (lineCount > 40)
            {
                table.BreakEnabled = true;
                table.RecomputeTableBlock(true);
                table.BreakFlowDirection = TableBreakFlowDirection.Right;
                table.BreakOptions = TableBreakOptions.RepeatTopLabels;
                table.SetBreakSpacing(16);
                table.SetBreakHeight(0, 12);
                table.SetBreakOffset(0, new Vector3d(1, 0, 0));
                table.RecomputeTableBlock(true);
            }
            table.GenerateLayout();
            return table;

 

I'm sure the code inside the if statement is getting executed but there is no change in the table at all. I've tried adjusting these settings with different values even though I'm not entirely sure what some of them do based on the documentation. I always get one long table with no breaks. (what's the difference between break spacing and break offset? it's not clear at all in the documentation.)

 

Can anyone help point me in the direction of what I'm missing here? Thanks!

 

 

Edit: Problem solved! For some reason Autocad wasn't setting BreakEnabled to true even though that line was in the code. I moved BreakEnabled=true to be after table.GenerateLayout() and now it works. Not entirely sure why but it's working now.

 

Accepted solutions (1)
1,935 Views
4 Replies
Replies (4)
Message 2 of 5

Anonymous
Not applicable

Hello,

 

I am having the same problem, but am not familiar with custom code in AutoCAD. I have a table that completely fills and extends beyond my layout's drawing boundary. I want my table break to simply copy over to a new sheet/layout. Is this something someone can help me with? The table break function looks to only work within the drawing space the table resides in.

0 Likes
Message 3 of 5

priya.mishraTPDMG
Participant
Participant

Hi @Anonymous  could you please help me with how you added the tables to the layout? I have created the tables in the modelspace and now I would like to copy/move them to the layout I created? 

 

Thankyou.

0 Likes
Message 4 of 5

essam-salah
Advisor
Advisor

hi @Anonymous 

why don't you break your data into the specific size you want previously before you generate the tables?

0 Likes
Message 5 of 5

Anonymous
Not applicable
Accepted solution

@priya.mishraTPDMG  I'm sorry I was only working in modelspace so I wouldn't be able to help you with that. You might want to start a new topic so that people more knowledgeable than myself might be able to assist.

 

@essam-salah I think the issue was that I was working with multiple tables of variable size within a limited amount of space, but the issue has been solved some time ago. Thanks for the assist though!

0 Likes