Gettting Tab info
Gettting Tab info
hi;
I need to getting tab information. (Tab's position of a paragraph)
The document start look like this
...
text.tab.tab.text.tab.tab.text.tab.text
...
I tried to getting tab info using this code.
var
..
xitemno: TCustomRVItemInfo;
xparano : integer;
xtabinfo : TrvTabInfos ;
..
begin
..
xitemno:=RVE.Getitem(count);
xparano:=xitemno.Parano;
xtabinfo:=rvstyle.parastyles[xparano].Tabs;
// this line returns zero. but line contains more than one tabs.
showmessage(inttostr(xtabinfo.count));
end;
Can you help me getting tab information. (Tab.count, tab.position, tab.leader etc);
Thanks in advise.
I need to getting tab information. (Tab's position of a paragraph)
The document start look like this
...
text.tab.tab.text.tab.tab.text.tab.text
...
I tried to getting tab info using this code.
var
..
xitemno: TCustomRVItemInfo;
xparano : integer;
xtabinfo : TrvTabInfos ;
..
begin
..
xitemno:=RVE.Getitem(count);
xparano:=xitemno.Parano;
xtabinfo:=rvstyle.parastyles[xparano].Tabs;
// this line returns zero. but line contains more than one tabs.
showmessage(inttostr(xtabinfo.count));
end;
Can you help me getting tab information. (Tab.count, tab.position, tab.leader etc);
Thanks in advise.
-
- Site Admin
- Posts: 17566
- Joined: Sat Aug 27, 2005 10:28 am
- Contact:
Re: Gettting Tab info
The collection RVStyle.ParaStyles[].Tabs is a collection of potential tab positions. In the ActionTest demo, you can see these tab positions as checks on the ruler above the editor.
Tabs in document are added by pressing tabs, but stored in document not as a tab character, but as an item of TRVTabItemInfo class. When formatting, TRichView determines which tab position (from RVStyle.ParaStyles[].Tabs) is used by each tab item. However, it does not mean that each tab position is used, and not all tab items use tab positions (for example, if the tab is to the right of the last tab position, its position is calculated using RVStyle.DefTabWidth property).
TRichView does not store information which tab position is used for tabs. Instead, it assigns Leader and Align from the tab position to tab item.
Tabs in document are added by pressing tabs, but stored in document not as a tab character, but as an item of TRVTabItemInfo class. When formatting, TRichView determines which tab position (from RVStyle.ParaStyles[].Tabs) is used by each tab item. However, it does not mean that each tab position is used, and not all tab items use tab positions (for example, if the tab is to the right of the last tab position, its position is calculated using RVStyle.DefTabWidth property).
TRichView does not store information which tab position is used for tabs. Instead, it assigns Leader and Align from the tab position to tab item.
Re: Gettting Tab info
Thanks for your reply.
I need an analyse of document items. After loading and formatting a document which is saved RTF format.
I can take about information of texts (font, size, font syyle etc.)
I can take about information of tables (cell, row,col, etc)
If a default DefTabWidth is 50 (px) possible tab positions are 0, 50, 100, 150, 200, 250... so on.
How can I determine used tab s info?
I need an analyse of document items. After loading and formatting a document which is saved RTF format.
I can take about information of texts (font, size, font syyle etc.)
I can take about information of tables (cell, row,col, etc)
If a default DefTabWidth is 50 (px) possible tab positions are 0, 50, 100, 150, 200, 250... so on.
How can I determine used tab s info?
-
- Site Admin
- Posts: 17566
- Joined: Sat Aug 27, 2005 10:28 am
- Contact:
Re: Gettting Tab info
Can you be more specific, what information do you want to receive?
You asked about tab count. What tab count do you mean? Count of tab stops in paragraph properties? Count of tab characters in a line (if yes, which line?). Or maybe something different?
You asked about tab count. What tab count do you mean? Count of tab stops in paragraph properties? Count of tab characters in a line (if yes, which line?). Or maybe something different?
Re: Gettting Tab info
Hi;
I try to converting RTF document to a specific file format. (File format is not standart).So I need collecting item's info and item's type from RVE.
my codes is look likes
var
xitemstyle : integer;
xrvdata : TcustomRvdata;
xitemcount : integer;
..
xrvdata:=RVE.Rvdata;
for xitemcount:=0 to xrvdata.items.count-1 do begin
xitemstyle:=xrvdata.getitemstyle(xcount);
if xitemstyle>-1 then
gettextinfo; // Getting font properties and paragraph properties ... ?? Paragraf properties tab s info
if xitemstyle<0 then begin
case xitemstyle of
-3 : getpictureinfo(xitemcount);// This is ok.I retrive necessary information about picture
-10 : getpictureinfo(xitemcount);
-60 : gettableinfo(xitemcount); // This is ok. I retrive row,col,cell properties, rowspan, colspan etc.
-12 : gettabinfo(xitemcount); // Tab'sinformation needing
end;
end;
end;
-- // write all information to spec file format. it needs tab's position.
I need tab's info when xitemstyle=-12
PS: sory for my bad english
I try to converting RTF document to a specific file format. (File format is not standart).So I need collecting item's info and item's type from RVE.
my codes is look likes
var
xitemstyle : integer;
xrvdata : TcustomRvdata;
xitemcount : integer;
..
xrvdata:=RVE.Rvdata;
for xitemcount:=0 to xrvdata.items.count-1 do begin
xitemstyle:=xrvdata.getitemstyle(xcount);
if xitemstyle>-1 then
gettextinfo; // Getting font properties and paragraph properties ... ?? Paragraf properties tab s info
if xitemstyle<0 then begin
case xitemstyle of
-3 : getpictureinfo(xitemcount);// This is ok.I retrive necessary information about picture
-10 : getpictureinfo(xitemcount);
-60 : gettableinfo(xitemcount); // This is ok. I retrive row,col,cell properties, rowspan, colspan etc.
-12 : gettabinfo(xitemcount); // Tab'sinformation needing
end;
end;
end;
-- // write all information to spec file format. it needs tab's position.
I need tab's info when xitemstyle=-12
PS: sory for my bad english
-
- Site Admin
- Posts: 17566
- Joined: Sat Aug 27, 2005 10:28 am
- Contact:
Re: Gettting Tab info
There is a huge difference between tabs and all these objects.
When you specify picture properties, you specify properties for this specific picture. This picture will still have these properties if you add other content in document, or if you move the picture in another location. Properties of pictures are stored in files (RTF, RTF, etc.). The same for tables and other objects.
But tabs are very different. There are no tab properties that are stored in files (except for text attributes, like font or color). Tab position (distance from the left size), alignment and leader characters do not belong to the tab properties. They are assigned when document is formatted. In TRichView, line wrapping depend on window width. This means that when you resize TRichView window, some tabs may be moved to the new line, so their positions, alignment and leader characters may be different.
For example. Let we have a paragraph having two tab stops in properties: (329px, no leader char), (729px, '.' as leader char), and a text that has two tabs that matches these tab stops:
Now we just resize the window. Now there are two lines with tabs. Each of these lines has one tab, the both of them match the tab stop (329px, no leader char). The tab stop (729px, '.' as leader char) still exists in the paragraph properties, but it is unused: As I said, this behavior correspond to saving tabs in RTF, RVF and DocX. Properties like position, alignment, leader character are stored not as properties of the specific tab character, but as properties of paragraphs. And tabs and tabs stops are matched when document is formatted, and the result depend on how the document is displayed. Probably it is the same in this custom file format (?)
When you specify picture properties, you specify properties for this specific picture. This picture will still have these properties if you add other content in document, or if you move the picture in another location. Properties of pictures are stored in files (RTF, RTF, etc.). The same for tables and other objects.
But tabs are very different. There are no tab properties that are stored in files (except for text attributes, like font or color). Tab position (distance from the left size), alignment and leader characters do not belong to the tab properties. They are assigned when document is formatted. In TRichView, line wrapping depend on window width. This means that when you resize TRichView window, some tabs may be moved to the new line, so their positions, alignment and leader characters may be different.
For example. Let we have a paragraph having two tab stops in properties: (329px, no leader char), (729px, '.' as leader char), and a text that has two tabs that matches these tab stops:
Now we just resize the window. Now there are two lines with tabs. Each of these lines has one tab, the both of them match the tab stop (329px, no leader char). The tab stop (729px, '.' as leader char) still exists in the paragraph properties, but it is unused: As I said, this behavior correspond to saving tabs in RTF, RVF and DocX. Properties like position, alignment, leader character are stored not as properties of the specific tab character, but as properties of paragraphs. And tabs and tabs stops are matched when document is formatted, and the result depend on how the document is displayed. Probably it is the same in this custom file format (?)
Re: Gettting Tab info
The custom format's editor is a page based. No window or editable area based. Editor main windows is 1024*800 display full page, when main window size is 1024*400 display 1/2 of full page. The custom format save tabs are chr(9). The paragraph properties has got a tabset properties which is possible tab's position.
If I getting tab's position when display a specific window size (eg width=800 to equal custom formar editor's full page size. This 800px may be need some testing to same display same things to correctly displaying tabs and paragraf's). My convert program works onyl 800 px main window size.
It is enough for me.
If I getting tab's position when display a specific window size (eg width=800 to equal custom formar editor's full page size. This 800px may be need some testing to same display same things to correctly displaying tabs and paragraf's). My convert program works onyl 800 px main window size.
It is enough for me.
-
- Site Admin
- Posts: 17566
- Joined: Sat Aug 27, 2005 10:28 am
- Contact:
Re: Gettting Tab info
So you have tabs stops in paragraph properties, and tab characters in text. Just like in RVF, RTF or DocX.
Matching between tab stops and tab characters is performed at the time of formatting/displaying, and may be different in different editors.
So I do not understand, why do you need this information for exporting?
Information about which tab stop is used for the given tab character (TRVTabItemInfo item) is not stored in TRichView. Of course, you can get coordinates of this tab character and find the proper position, but it can be easily done only by left-aligned tabs in left-aligned paragraphs.
However, you can get alignment and leader character.
In gettabinfo(), you can use GetItem, typecast the result to TRVTabItemInfo, use Align and Leader properties.
Matching between tab stops and tab characters is performed at the time of formatting/displaying, and may be different in different editors.
So I do not understand, why do you need this information for exporting?
Information about which tab stop is used for the given tab character (TRVTabItemInfo item) is not stored in TRichView. Of course, you can get coordinates of this tab character and find the proper position, but it can be easily done only by left-aligned tabs in left-aligned paragraphs.
However, you can get alignment and leader character.
In gettabinfo(), you can use GetItem, typecast the result to TRVTabItemInfo, use Align and Leader properties.
Re: Gettting Tab info
Hi Sergey;
-->
Information about which tab stop is used for the given tab character (TRVTabItemInfo item) is not stored in TRichView. Of course, you can get coordinates of this tab character and find the proper position, but it can be easily done only by left-aligned tabs in left-aligned paragraphs.
-->
can you share some code examples?
(When I try to this I have got error tabs.count return always zero? Possible I have mistake but I didn't find my mistakes.)
-->
Information about which tab stop is used for the given tab character (TRVTabItemInfo item) is not stored in TRichView. Of course, you can get coordinates of this tab character and find the proper position, but it can be easily done only by left-aligned tabs in left-aligned paragraphs.
-->
can you share some code examples?
(When I try to this I have got error tabs.count return always zero? Possible I have mistake but I didn't find my mistakes.)
-
- Site Admin
- Posts: 17566
- Joined: Sat Aug 27, 2005 10:28 am
- Contact:
Re: Gettting Tab info
Probably you still confuse tabs (tab characters) and tab stops.
On the picture below, I enumerated allowed tab stops, from 1 to 7: The first two tab stops are defined in Tabs collection, the ruler shows them as "L" sign. Subsequent tab stops are calculated automatically using DefTabWidth, the ruler shows them as small ticks.
Tab stops and tab characters are different things!
ParaStyle.Tabs (collection of tab stops) is empty by default. This collection can be edited in the paragraph dialog (page Tabs) and using the ruler (click adds a tab stop).
I have a problem in writing a code sample because I still do not understand what you want.
On the picture below, I enumerated allowed tab stops, from 1 to 7: The first two tab stops are defined in Tabs collection, the ruler shows them as "L" sign. Subsequent tab stops are calculated automatically using DefTabWidth, the ruler shows them as small ticks.
Tab stops and tab characters are different things!
ParaStyle.Tabs (collection of tab stops) is empty by default. This collection can be edited in the paragraph dialog (page Tabs) and using the ruler (click adds a tab stop).
I have a problem in writing a code sample because I still do not understand what you want.
Re: Gettting Tab info
Thanks for your reply ;
I understand that why always paragraph.tabs.count return zero.
is the defaultTab.Position changing when after loading and formatting RTF document?
I understand that why always paragraph.tabs.count return zero.
is the defaultTab.Position changing when after loading and formatting RTF document?
-
- Site Admin
- Posts: 17566
- Joined: Sat Aug 27, 2005 10:28 am
- Contact:
Re: Gettting Tab info
No, this probably is not saved to and not loaded from RTF.
Probably, it will be future versions.
Probably, it will be future versions.