Hi,
I want to display some data of variable length in scalerichview as given in the attachment. The Data is taken from a stringgrid. and load to scalerichview by a for ..loop
Can you please guide?
Thanks in advance
Regards
Columns / Tables
Columns / Tables
- Attachments
-
- Untitled.jpg (47.31 KiB) Viewed 57894 times
-
- Site Admin
- Posts: 17602
- Joined: Sat Aug 27, 2005 10:28 am
- Contact:
Re: Columns / Tables
It looks like a table.
Do you want a code showing how to add a table?
Do you want a code showing how to add a table?
Re: Columns / Tables
Yes , it is like a table. An example code will be greatly appreciated. Also, it would be usel if the example can show how to set the width of a column.
I tried the following code from an example of spreadsheet, but the table is not displayed. But when i did this in the spread sheet example by inserting the Scalerichview instead of the richviewedit, it works there.
CareTable := TRVTableItemInfo.CreateEx(10, 6, FinalData.RichViewEdit.RVData);
CareTable.BorderWidth := 1;
CareTable.CellBorderWidth := 1;
CareTable.CellBorderStyle := rvtbLowered;
CareTable.CellBorderColor := clBtnFace;
CareTable.BorderStyle := rvtbLowered;
for rows := 0 to CareTable.Rows.Count - 1 do begin
for cols := 0 to CareTable.Rows[rows].Count - 1 do
CareTable.Cells[rows, cols].Clear;
end;
CareTable.Cells[0, 0].AddNL('Date & Time', 1, 1);
CareTable.Cells[0, 1].AddNL('Assessment', 1, 1);
CareTable.Cells[0, 2].AddNL('Nursing Diagnosis', 1, 1);
CareTable.Cells[0, 3].AddNL('Nursing Intervention', 1, 1);
CareTable.Cells[0, 4].AddNL('Evaluation', 1, 1);
CareTable.Cells[0, 5].AddNL('Entered by', 1, 1);
CareTable.Cells[0, 1].BestWidth := -60;
FinalData.RichViewEdit.InsertItem('NursesCareData', CareTable);
FinalData.RichViewEdit.ApplyParaStyle(1);
FinalData.RichViewEdit.Format;
Thanks in advance
I tried the following code from an example of spreadsheet, but the table is not displayed. But when i did this in the spread sheet example by inserting the Scalerichview instead of the richviewedit, it works there.
CareTable := TRVTableItemInfo.CreateEx(10, 6, FinalData.RichViewEdit.RVData);
CareTable.BorderWidth := 1;
CareTable.CellBorderWidth := 1;
CareTable.CellBorderStyle := rvtbLowered;
CareTable.CellBorderColor := clBtnFace;
CareTable.BorderStyle := rvtbLowered;
for rows := 0 to CareTable.Rows.Count - 1 do begin
for cols := 0 to CareTable.Rows[rows].Count - 1 do
CareTable.Cells[rows, cols].Clear;
end;
CareTable.Cells[0, 0].AddNL('Date & Time', 1, 1);
CareTable.Cells[0, 1].AddNL('Assessment', 1, 1);
CareTable.Cells[0, 2].AddNL('Nursing Diagnosis', 1, 1);
CareTable.Cells[0, 3].AddNL('Nursing Intervention', 1, 1);
CareTable.Cells[0, 4].AddNL('Evaluation', 1, 1);
CareTable.Cells[0, 5].AddNL('Entered by', 1, 1);
CareTable.Cells[0, 1].BestWidth := -60;
FinalData.RichViewEdit.InsertItem('NursesCareData', CareTable);
FinalData.RichViewEdit.ApplyParaStyle(1);
FinalData.RichViewEdit.Format;
Thanks in advance
-
- Site Admin
- Posts: 17602
- Joined: Sat Aug 27, 2005 10:28 am
- Contact:
Re: Columns / Tables
Does this code work?
It looks ok, but:
- if you generate document, and want to add a table to the end, call
- if you want to insert the table in the caret position, as an editing operation, call
or, better (to allow undoing in a single step):
It looks ok, but:
- if you generate document, and want to add a table to the end, call
Code: Select all
CareTable.ParaNo := 1;
FinalData.RichViewEdit.AddItem('NursesCareData', CareTable);
FinalData.RichViewEdit.Format;
Code: Select all
FinalData.RichViewEdit.InsertItem('NursesCareData', CareTable);
FinalData.RichViewEdit.ApplyParaStyle(1);
Code: Select all
FinalData.RichViewEdit.TopLevelEditor.BeginUndoGroup(rvutInsert);
FinalData.RichViewEdit.TopLevelEditor.SetUndoGroupMode(True);
FinalData.RichViewEdit.AddItem('NursesCareData', CareTable);
FinalData.RichViewEdit.Format;
FinalData.RichViewEdit.TopLevelEditor.SetUndoGroupMode(False);
Re: Columns / Tables
Thank you very very much for the prompt solution. Saved me. Just want I wanted.
Regards,
Regards,