Break not displayed
Posted: Sun Feb 17, 2008 6:18 pm
Hi,
2 questions please:
First: when i create a new table like this:
table = new TRVTableItemInfo(4,4, RichView1->RVData);
How can i free the resource ?
if i put a 'delete table;' after i insert the table in RichView1 and format it, get a nasty error. So how can i free the resource ? Because if i spam the button to add tables, without to release the resources, when i exit the program i get a nasty error too.
Second question is:
when i add a break like this:
RichView1->AddBreakEx(4, rvbsLine, clBlue);
is all ok, displayed ok, i save RTF, when i load it again, no break line.
If i open it with Microsoft Word , the break is there, so the problem is on Load, not on Save.
Take into account is about RichView not RichViewEdit, but i tested with RichViewEdit too and it does the same, on load RTF does not display the break... i changed the background color thinking is loaded on white color instead of blue, but nope... it just does not loads it...
this is the code:
int r,c;
AnsiString Target = "www.website.com";
for(int i = 0; i< RVStyle1->TextStyles->Count; i++)
RVStyle1->TextStyles->Items->Charset = EASTEUROPE_CHARSET;
table = new TRVTableItemInfo(4,4, RichView1->RVData);
table->BorderWidth = 1;
table->CellBorderWidth = 1;
table->CellBorderStyle = rvtbColor;
table->CellBorderColor = clBtnFace;
table->BorderStyle = rvtbColor;
// Each cell initially contains one empty text item. Deleting it
for (r=0; r<table->Rows->Count; r++)
for (c=0; c<table->Rows->Items[r]->Count; c++)
table->Cells[r][c]->Clear();
table->SetTableVisibleBorders(0,0,0,0);
table->SetCellVisibleBorders(0,0,0,0,0,0);
table->SetCellVisibleBorders(0,0,0,0,1,0);
table->SetCellVisibleBorders(0,0,0,0,2,0);
table->SetCellVisibleBorders(0,0,0,0,3,0);
table->SetCellVisibleBorders(0,0,0,0,0,3);
table->SetCellVisibleBorders(0,0,0,0,1,3);
table->SetCellVisibleBorders(0,0,0,0,2,3);
table->SetCellVisibleBorders(0,0,0,0,3,3);
table->Cells[0][1]->AddNL("Phone Brand",1,1);
table->Cells[1][1]->AddNL("Phone Model",1,1);
table->Cells[2][1]->AddNL("Unlock Type",1,1);
table->Cells[3][1]->AddNL("Operation",1,1);
table->SetCellBestWidth(200,0,1);
table->SetCellBestWidth(200,0,2);
table->Cells[0][2]->AddNL("Alcatel", 5, 1);
table->Cells[1][2]->AddNL("OT735", 5, 1);
table->Cells[2][2]->AddNL("Unlock by IMEI", 5, 1);
table->Cells[3][2]->AddNL("-", 5, 1);
for (c=0; c<table->ColCount; c++)
{
table->Cells[c][1]->Color = 0x00E6E6E6;
table->Cells[c][2]->Color = 0x00E6E6E6;
}
table->InsertRows(table->Rows->Count,1,0,false);
for (c=0; c<table->Rows->Items[table->Rows->Count-1]->Count; c++)
table->Cells[table->Rows->Count-1][c]->Clear();
table->Cells[table->Rows->Count-1][1]->AddNL("IMEI",1,1);
table->Cells[table->Rows->Count-1][2]->AddNL("12345678901234",5,1);
table->InsertRows(table->Rows->Count,1,0,false);
table->Cells[table->Rows->Count-1][2]->Color = clWhite;
table->Cells[table->Rows->Count-1][1]->Color = clWhite;
table->SetCellVisibleBorders(0,0,0,0,table->Rows->Count-1,1);
table->SetCellVisibleBorders(0,0,0,0,table->Rows->Count-1,2);
table->InsertRows(table->Rows->Count,1,0,false);
for (c=0; c<table->Rows->Items[table->Rows->Count-1]->Count; c++)
table->Cells[table->Rows->Count-1][c]->Clear();
table->Cells[table->Rows->Count-1][1]->AddNL("NCK",1,1);
table->Cells[table->Rows->Count-1][2]->AddNL("111111",6,2);
table->Cells[table->Rows->Count-1][2]->Color = 0x00E6E6E6;
table->InsertRows(table->Rows->Count,1,0,false);
for (c=0; c<table->Rows->Items[table->Rows->Count-1]->Count; c++)
table->Cells[table->Rows->Count-1][c]->Clear();
table->Cells[table->Rows->Count-1][1]->AddNL("SPCK",1,1);
table->Cells[table->Rows->Count-1][2]->AddNL("222222",6,2);
table->Cells[table->Rows->Count-1][2]->Color = 0x00E6E6E6;
table->ParaNo = 1;
jp->Assign(Image3->Picture->Graphic);
RichView1->AddNL("",2,0);
RichView1->AddNL("Finished Job !",7,1);
RichView1->AddNL("",2,0);
RichView1->AddBreakEx(4, rvbsLine, clBlue);
RichView1->AddNL("",2,0);
RichView1->AddPictureEx("", jp, 1, rvvaBaseline);
RichView1->AddNL("",2,0);
RichView1->AddItem("Spreadsheet", table);
RichView1->AddNL("",2,0);
RichView1->AddBreakEx(4, rvbsLine, clBlue);
RichView1->AddNL("",2,0);
RichView1->AddNLTag(Target,3,1, (int)StrNew(Target.c_str()));
RichView1->Format();
Regards
Vlad
2 questions please:
First: when i create a new table like this:
table = new TRVTableItemInfo(4,4, RichView1->RVData);
How can i free the resource ?
if i put a 'delete table;' after i insert the table in RichView1 and format it, get a nasty error. So how can i free the resource ? Because if i spam the button to add tables, without to release the resources, when i exit the program i get a nasty error too.
Second question is:
when i add a break like this:
RichView1->AddBreakEx(4, rvbsLine, clBlue);
is all ok, displayed ok, i save RTF, when i load it again, no break line.
If i open it with Microsoft Word , the break is there, so the problem is on Load, not on Save.
Take into account is about RichView not RichViewEdit, but i tested with RichViewEdit too and it does the same, on load RTF does not display the break... i changed the background color thinking is loaded on white color instead of blue, but nope... it just does not loads it...
this is the code:
int r,c;
AnsiString Target = "www.website.com";
for(int i = 0; i< RVStyle1->TextStyles->Count; i++)
RVStyle1->TextStyles->Items->Charset = EASTEUROPE_CHARSET;
table = new TRVTableItemInfo(4,4, RichView1->RVData);
table->BorderWidth = 1;
table->CellBorderWidth = 1;
table->CellBorderStyle = rvtbColor;
table->CellBorderColor = clBtnFace;
table->BorderStyle = rvtbColor;
// Each cell initially contains one empty text item. Deleting it
for (r=0; r<table->Rows->Count; r++)
for (c=0; c<table->Rows->Items[r]->Count; c++)
table->Cells[r][c]->Clear();
table->SetTableVisibleBorders(0,0,0,0);
table->SetCellVisibleBorders(0,0,0,0,0,0);
table->SetCellVisibleBorders(0,0,0,0,1,0);
table->SetCellVisibleBorders(0,0,0,0,2,0);
table->SetCellVisibleBorders(0,0,0,0,3,0);
table->SetCellVisibleBorders(0,0,0,0,0,3);
table->SetCellVisibleBorders(0,0,0,0,1,3);
table->SetCellVisibleBorders(0,0,0,0,2,3);
table->SetCellVisibleBorders(0,0,0,0,3,3);
table->Cells[0][1]->AddNL("Phone Brand",1,1);
table->Cells[1][1]->AddNL("Phone Model",1,1);
table->Cells[2][1]->AddNL("Unlock Type",1,1);
table->Cells[3][1]->AddNL("Operation",1,1);
table->SetCellBestWidth(200,0,1);
table->SetCellBestWidth(200,0,2);
table->Cells[0][2]->AddNL("Alcatel", 5, 1);
table->Cells[1][2]->AddNL("OT735", 5, 1);
table->Cells[2][2]->AddNL("Unlock by IMEI", 5, 1);
table->Cells[3][2]->AddNL("-", 5, 1);
for (c=0; c<table->ColCount; c++)
{
table->Cells[c][1]->Color = 0x00E6E6E6;
table->Cells[c][2]->Color = 0x00E6E6E6;
}
table->InsertRows(table->Rows->Count,1,0,false);
for (c=0; c<table->Rows->Items[table->Rows->Count-1]->Count; c++)
table->Cells[table->Rows->Count-1][c]->Clear();
table->Cells[table->Rows->Count-1][1]->AddNL("IMEI",1,1);
table->Cells[table->Rows->Count-1][2]->AddNL("12345678901234",5,1);
table->InsertRows(table->Rows->Count,1,0,false);
table->Cells[table->Rows->Count-1][2]->Color = clWhite;
table->Cells[table->Rows->Count-1][1]->Color = clWhite;
table->SetCellVisibleBorders(0,0,0,0,table->Rows->Count-1,1);
table->SetCellVisibleBorders(0,0,0,0,table->Rows->Count-1,2);
table->InsertRows(table->Rows->Count,1,0,false);
for (c=0; c<table->Rows->Items[table->Rows->Count-1]->Count; c++)
table->Cells[table->Rows->Count-1][c]->Clear();
table->Cells[table->Rows->Count-1][1]->AddNL("NCK",1,1);
table->Cells[table->Rows->Count-1][2]->AddNL("111111",6,2);
table->Cells[table->Rows->Count-1][2]->Color = 0x00E6E6E6;
table->InsertRows(table->Rows->Count,1,0,false);
for (c=0; c<table->Rows->Items[table->Rows->Count-1]->Count; c++)
table->Cells[table->Rows->Count-1][c]->Clear();
table->Cells[table->Rows->Count-1][1]->AddNL("SPCK",1,1);
table->Cells[table->Rows->Count-1][2]->AddNL("222222",6,2);
table->Cells[table->Rows->Count-1][2]->Color = 0x00E6E6E6;
table->ParaNo = 1;
jp->Assign(Image3->Picture->Graphic);
RichView1->AddNL("",2,0);
RichView1->AddNL("Finished Job !",7,1);
RichView1->AddNL("",2,0);
RichView1->AddBreakEx(4, rvbsLine, clBlue);
RichView1->AddNL("",2,0);
RichView1->AddPictureEx("", jp, 1, rvvaBaseline);
RichView1->AddNL("",2,0);
RichView1->AddItem("Spreadsheet", table);
RichView1->AddNL("",2,0);
RichView1->AddBreakEx(4, rvbsLine, clBlue);
RichView1->AddNL("",2,0);
RichView1->AddNLTag(Target,3,1, (int)StrNew(Target.c_str()));
RichView1->Format();
Regards
Vlad