With this code following, i get List Index Out of bounds error, but ONLY for last version registered RichView, with the Unregistered version it works !!!!
This line is the problem:
table->InsertRows(table->Rows->Count,1,0,false);
I managed to insert new rows but only with:
table->Rows->Insert(table->Rows->Count,table->ColCount);
InsertRows just gives error
If is this a bug please tell me what lines to modify in component, i am in hurry to release the update today, and i cannot wait until next release. Or if something has changed in sintax please advise.
Code:
table = new TRVTableItemInfo(4,4, RichView1->RVData);
int r,c;
table->BorderWidth = 1;
table->CellBorderWidth = 1;
table->CellBorderStyle = rvtbColor;
table->CellBorderColor = clBtnFace;
table->BorderStyle = rvtbColor;
for (r=0; r<table->Rows->Count; r++)
for (c=0; c<table->Rows->Items[r]->Count; c++)
{
table->Cells[r][c]->Clear();
table->Cells[r][c]->Color = 0x00E6E6E6;
}
table->SetTableVisibleBorders(0,0,0,0);
for(int i = 0; i<4; i++)
{
table->SetCellVisibleBorders(0,0,0,0,i,0);
table->Cells[0]->Color = clWhite;
}
for(int i = 0; i<4; i++)
{
table->SetCellVisibleBorders(0,0,0,0,i,3);
table->Cells[3]->Color = clWhite;
}
table->Cells[0][1]->AddNL("Brand",5,1);
table->Cells[1][1]->AddNL("Model",5,1);
table->Cells[2][1]->AddNL("Type",5,1);
table->Cells[3][1]->AddNL("Option",5,1);
table->SetCellBestWidth(200,0,1);
table->SetCellBestWidth(200,0,2);
table->Cells[0][2]->AddNL("gggg",3,1);
table->Cells[1][2]->AddNL("hhhhhh",3,1);
table->Cells[2][2]->AddNL("tttttt",3,1);
table->Cells[3][2]->AddNL("6666666",3,1);
table->InsertRows(table->Rows->Count,1,0,false);
RichView1->AddItem("Spreadsheet", table);
RichView1->Format();
Regards
Vlad
Possible table bug
Possible table bug
Last edited by wray on Thu Feb 21, 2008 3:14 pm, edited 1 time in total.
-
- Site Admin
- Posts: 17534
- Joined: Sat Aug 27, 2005 10:28 am
- Contact:
InsertRows copies properties of cells the specified row (the last parameter) to the inserted cells.
The new version, in addition to other cell properties, copies text and paragraph styles of cells (paragraph style of the first paragraph in the cell, text style of the fist text item in the cell). It expects that cells have at least one item.
Initially, all cells have one empty text item, but you cleared all of them, and you did not add them for the first and the last column. TRichView will restore them when you insert table, but you call InsertRows before the insertion (and it is correct).
I will fix it, but you can reconsider clearing the first and the last column.
By the way, you achieve this effect (blank space to the left and to the right of the table) without empty columns, just assign table->BorderHSpacing.
And to hide borders, you can simply set table->BorderWidth = table->CellBorderWidth = 0.
The new version, in addition to other cell properties, copies text and paragraph styles of cells (paragraph style of the first paragraph in the cell, text style of the fist text item in the cell). It expects that cells have at least one item.
Initially, all cells have one empty text item, but you cleared all of them, and you did not add them for the first and the last column. TRichView will restore them when you insert table, but you call InsertRows before the insertion (and it is correct).
I will fix it, but you can reconsider clearing the first and the last column.
By the way, you achieve this effect (blank space to the left and to the right of the table) without empty columns, just assign table->BorderHSpacing.
And to hide borders, you can simply set table->BorderWidth = table->CellBorderWidth = 0.
Good hints thank you...
I add empty cells, because i want the same spacing before and after the "good" cells, especially because the RichView is scalable, and when is maximizing, i need the leading and trailing cells to change size but the "good" cells to remain fixed in center of RichView... Adding these empty cells solved fast this problem
I managed to make it work with:
table->Rows->Insert(table->Rows->Count,table->ColCount);
I will use it for the time beeing, until you release update.
Regards
Vlad
I add empty cells, because i want the same spacing before and after the "good" cells, especially because the RichView is scalable, and when is maximizing, i need the leading and trailing cells to change size but the "good" cells to remain fixed in center of RichView... Adding these empty cells solved fast this problem
I managed to make it work with:
table->Rows->Insert(table->Rows->Count,table->ColCount);
I will use it for the time beeing, until you release update.
Regards
Vlad
-
- Site Admin
- Posts: 17534
- Joined: Sat Aug 27, 2005 10:28 am
- Contact: