GetItemStyle
GetItemStyle
Hello, administrator
Ask a question. I have a document containing text, pictures, components, forms, etc. How can I decide which item is a form or text.
My code is as follows:
For I: = 0 to TmpSRichViewEdit. RichViewEdit. Do ItemCount - 1
The begin
If TmpSRichViewEdit. RichViewEdit. RVData. GetItemStyle (I) = rvsTable then begin
TableTmp: = TRVTableItemInfo (TmpSRichViewEdit. RichViewEdit. RVData. The GetItem (I));
... This is the form
End else begin / / normal content
...... This judgment is text
The end;
The end;
Thank you very much!
Ask a question. I have a document containing text, pictures, components, forms, etc. How can I decide which item is a form or text.
My code is as follows:
For I: = 0 to TmpSRichViewEdit. RichViewEdit. Do ItemCount - 1
The begin
If TmpSRichViewEdit. RichViewEdit. RVData. GetItemStyle (I) = rvsTable then begin
TableTmp: = TRVTableItemInfo (TmpSRichViewEdit. RichViewEdit. RVData. The GetItem (I));
... This is the form
End else begin / / normal content
...... This judgment is text
The end;
The end;
Thank you very much!
-
- Site Admin
- Posts: 17522
- Joined: Sat Aug 27, 2005 10:28 am
- Contact:
Re: GetItemStyle
If GetItemStyle returns zero or positive value, this is a text item. The returned value is the index in the collection TmpSRichViewEdit.RichViewEdit.Style.TextStyles.
If GetItemStyle returns a negative value, this is a non-text item. The list of items is here:
http://www.trichview.com/help/idh_const_rvsxxx.html
If GetItemStyle returns a negative value, this is a non-text item. The list of items is here:
http://www.trichview.com/help/idh_const_rvsxxx.html
Re: GetItemStyle
Hi Sergey Tkachenko
I have a document at the time of editing, the text has multiple colors to distinguish, but at the time of printing requirements to print all black font, in my judgment in the way you modify the document font color, but some will be garbled words? The HTML code is as follows: for I: = 0 to TmpSRichViewEdit. RichViewEdit. Do ItemCount - 1
The begin
If TmpSRichViewEdit. RichViewEdit. RVData. GetItemStyle (I) = rvsTable rvsTable then / / form
The begin
TableTmp: = TRVTableItemInfo (TmpSRichViewEdit. RichViewEdit. RVData. The GetItem (I));
For tmpRow: = 0 to TableTmp. RowCount - 1 do / / line count
The begin
For tmpCol: = 0 to TableTmp. ColCount - 1 do / / column number
The begin
If TableTmp. Cells [tmpRow tmpCol] < > nil then
The begin
RVData: = TableTmp Cells [tmpRow, tmpCol]. GetRVData;
For tmpTtemNO: = 0 to RVData. ItemCount - 1 do
The begin
If rvdata.getitemstyle (tmpTtemNO) > = 0 then / / greater than or equal to 0 represents text
RVData. The GetItem (tmpTtemNO). StyleNo: = 0; / / cancel the font color
The end;
The end;
The end;
The end;
End else begin / / normal content
If TmpSRichViewEdit. RichViewEdit. GetItemStyle (I) > = 0 then / / is greater than or equal to 0 (text
TmpSRichViewEdit. RichViewEdit. The GetItem (I). The StyleNo: = 0; / / cancel the font color
The end;
The end;
Is there a problem with the way I changed the color of the font? thank you
I have a document at the time of editing, the text has multiple colors to distinguish, but at the time of printing requirements to print all black font, in my judgment in the way you modify the document font color, but some will be garbled words? The HTML code is as follows: for I: = 0 to TmpSRichViewEdit. RichViewEdit. Do ItemCount - 1
The begin
If TmpSRichViewEdit. RichViewEdit. RVData. GetItemStyle (I) = rvsTable rvsTable then / / form
The begin
TableTmp: = TRVTableItemInfo (TmpSRichViewEdit. RichViewEdit. RVData. The GetItem (I));
For tmpRow: = 0 to TableTmp. RowCount - 1 do / / line count
The begin
For tmpCol: = 0 to TableTmp. ColCount - 1 do / / column number
The begin
If TableTmp. Cells [tmpRow tmpCol] < > nil then
The begin
RVData: = TableTmp Cells [tmpRow, tmpCol]. GetRVData;
For tmpTtemNO: = 0 to RVData. ItemCount - 1 do
The begin
If rvdata.getitemstyle (tmpTtemNO) > = 0 then / / greater than or equal to 0 represents text
RVData. The GetItem (tmpTtemNO). StyleNo: = 0; / / cancel the font color
The end;
The end;
The end;
The end;
End else begin / / normal content
If TmpSRichViewEdit. RichViewEdit. GetItemStyle (I) > = 0 then / / is greater than or equal to 0 (text
TmpSRichViewEdit. RichViewEdit. The GetItem (I). The StyleNo: = 0; / / cancel the font color
The end;
The end;
Is there a problem with the way I changed the color of the font? thank you
-
- Site Admin
- Posts: 17522
- Joined: Sat Aug 27, 2005 10:28 am
- Contact:
Re: GetItemStyle
TRVPrint component has ColorMode property, allowing to print black-on-white text without document modification.
However, this feature is not supported by ScaleRichView, so you are right, you need to change text color in document.
If you need changing only text color, you do not need to analyze the whole document. You just need to change RVStyle:
This code makes all text items and list markers black.
However, this feature is not supported by ScaleRichView, so you are right, you need to change text color in document.
If you need changing only text color, you do not need to analyze the whole document. You just need to change RVStyle:
Code: Select all
procedure MakeBW(RVStyle: TRVStyle);
var
i, j: Integer;
begin
for i := 0 to RVStyle.TextStyles.Count - 1 do
begin
RVStyle.TextStyles[i].Color := clBlack;
RVStyle.TextStyles[i].BackColor := clNone;
end;
for i := 0 to RVStyle.ListStyles.Count - 1 do
for j := 0 to RVStyle.ListStyles[i].Levels.Count - 1 do
RVStyle.ListStyles[i].Levels[j].Font.Color := clBlack;
end;
procedure SRVMakeBW(Srv: TSRichViewEdit);
var
i: TSRVHeaderFooterType;
begin
MakeBW(Srv.RichViewEdit.Style);
for i := Low(TSRVHeaderFooterType) to High(TSRVHeaderFooterType) do
MakeBW(Srv.SubDocuments[i].GetRVStyle);
end;
SRVMakeBW
Hello, administrator
Sorry to have to bother you, I listen to your code changes, print text can black font, but I don't have any (TSRVHeaderFooterType) unit, I modify your code, do not know to have what effect, modify the code is as follows:
Procedure SRVMakeBW (Srv: TSRichViewEdit);
/ / var I: TSRVHeaderFooterType;
The begin
MakeBW (Srv) RichViewEdit) Style);
MakeBW (Srv) RVHeader) Style);
MakeBW (Srv) RVFooter) Style);
/ / for I: = Low (TSRVHeaderFooterType) to High (TSRVHeaderFooterType) do
/ / MakeBW (Srv SubDocuments GetRVStyle);
The end;
Currently, the TSRVComboBox control in the printed file is still in color, can it not be modified?
Sorry to have to bother you, I listen to your code changes, print text can black font, but I don't have any (TSRVHeaderFooterType) unit, I modify your code, do not know to have what effect, modify the code is as follows:
Procedure SRVMakeBW (Srv: TSRichViewEdit);
/ / var I: TSRVHeaderFooterType;
The begin
MakeBW (Srv) RichViewEdit) Style);
MakeBW (Srv) RVHeader) Style);
MakeBW (Srv) RVFooter) Style);
/ / for I: = Low (TSRVHeaderFooterType) to High (TSRVHeaderFooterType) do
/ / MakeBW (Srv SubDocuments GetRVStyle);
The end;
Currently, the TSRVComboBox control in the printed file is still in color, can it not be modified?
SRVMakeBW
Code: Select all
procedure SRVMakeBW(Srv: TSRichViewEdit);
//var i: TSRVHeaderFooterType;
begin
MakeBW(Srv.RichViewEdit.Style);
MakeBW(Srv.RVHeader.Style);
MakeBW(Srv.RVFooter.Style);
//for i := Low(TSRVHeaderFooterType) to High(TSRVHeaderFooterType) do
// MakeBW(Srv.SubDocuments[i].GetRVStyle);
end;
-
- Site Admin
- Posts: 17522
- Joined: Sat Aug 27, 2005 10:28 am
- Contact:
Re: GetItemStyle
Your change is correct, if you use an old version of ScaleRichView which does not support special headers and footers for the first page and odd/even pages.
For changing text color in controls, you really need to enumerate all items in the document and assign Font.Color. I'll make an example later.
For changing text color in controls, you really need to enumerate all items in the document and assign Font.Color. I'll make an example later.
Re: GetItemStyle
Sergey Tkachenko
Thank you very much, waiting for your presentation... I'll show you a screenshot of the color of the control.
Thank you very much, waiting for your presentation... I'll show you a screenshot of the color of the control.
- Attachments
-
- QQ图片20170727091225.png (28.81 KiB) Viewed 42763 times