Fix For Numbered Bullets In Tables?

General TRichView support forum. Please post your questions here
Post Reply
DickBryant
Posts: 148
Joined: Wed Dec 07, 2005 2:02 pm
Contact:

Fix For Numbered Bullets In Tables?

Post by DickBryant »

I access entries in a master table and place them in an edit window for the user to work on and then return them to the table.

When entering numbered, bulleted lists all is OK as long as the user is only looking at one table cell at a time.

Sometimes, though, the application needs to show the table itself and when this occurs, all of the numbers appear as if they are in the SAME list.

I.e. if Cell 0,1 has bullets numbered 1,2,3 and Cell 3,1 has bullets numbered 1,2,3 also, when I display the table showing both cells, the bullets in Cell 3,1 are numbered 4,5,6.

I believe we e-mailed about this at one time, but I can't find any reference here in the forum and I see the problem still exists in the latest versions of TRV and TRVA.
Sergey Tkachenko
Site Admin
Posts: 17566
Joined: Sat Aug 27, 2005 10:28 am
Contact:

Post by Sergey Tkachenko »

It's by design (if I understand you right). List markers of the same style are numbered sequentially through the whole document, including table cells.
DickBryant
Posts: 148
Joined: Wed Dec 07, 2005 2:02 pm
Contact:

Post by DickBryant »

I'd suggest that this should be a document option - or should be different for tables. It seems to me that tables with bulleted lists in subsequent rows of the table would more likely want the numbered bullets to restart for each new row than would want them to continue.

Any chance of adding this 'switch' in a future release? It's not a huge problem for me, but it does screw up the printing of flashcards with numbered bullets. The flashcards themselves are individual 'documents' so the bullets should be numbered independently for each one.

Dick
Sergey Tkachenko
Site Admin
Posts: 17566
Joined: Sat Aug 27, 2005 10:28 am
Contact:

Post by Sergey Tkachenko »

Numbering in TRichView works like numbering in new versions of MS Word (starting from Word 97). So it is unlikely will be changed.
I suggest using unique list style (with identical properties) for each cell instead.
DickBryant
Posts: 148
Joined: Wed Dec 07, 2005 2:02 pm
Contact:

Post by DickBryant »

Actually, this isn't the case - MSWord works 'correctly'. The difference is that in TRichView, the numbering in different cells is sequential EVEN when there is intervening text that is not part of the numbered bullets. In MSWord, any intervening text that is not part of the numbered bullets style resets the next numbered bullet to "1.".

I've sent you an example via e-mail.

Dick
Sergey Tkachenko
Site Admin
Posts: 17566
Joined: Sat Aug 27, 2005 10:28 am
Contact:

Post by Sergey Tkachenko »

In MS Word, intervening text and intervening list markers do not matter, like in TRichView.
You can test it by copy-pasting a paragraph from the first cell to the last cell (it's better to add an empty unnumbered line after the "to come to the aid of the party", and paste after this line). You will see that the inserted line will be numbered "4.", because it will continue numeration from the first cell.

It does matter how you make numbering, though. Word creates a different list (or "list overrides") when you apply numbering to different cells. RichViewActions do the same: if you press "Numbering" command in a cell, a new list will be created, and numbering will be started from 1.
So numbering in TRichView and MS Word works identically, it's only important how to create lists.

However, numeration in your example document is imported in TRichView incorrectly. I'll try to fix it.
DickBryant
Posts: 148
Joined: Wed Dec 07, 2005 2:02 pm
Contact:

Post by DickBryant »

Hmmm... I see what you mean about pasting into the cell vs. creating the bullet while in the cell. In my case it is analagous to pasting into the cell I think.

I create the contents in a separate TRichViewEdit and then place the contents into the master table by this code:

AMemo.SaveRVFToStream(Stream, False);
Stream.Position := 0;
FMain.RichViewEdit3.Clear;
FMain.RichViewEdit3.InsertRVFFromStream(Stream, 0);
FMain.RichViewEdit3.Format;
Stream.Clear;
FMain.RichViewEdit3.SaveRVFToStream(Stream,False);
Stream.Position := 0;
MasterRVTable.Cells[QNumber-1,15].Clear;
MasterRVTable.Cells[QNumber-1,15].InsertRVFFromStream(Stream, 0, Dummy1, Dummy2, Dummy3, False);
finally
Stream.Clear;
end;

Where AMemo is the separate TRichViewEdit edit window and FMain.RichViewEdit3 is an intermediate TRVE using the same TRVStyle as the TRVE containing MasterRVTable so as to preserve the font styles used in creating the content in AMemo.

Is there any way other than using independent ListStyles to get this to work with fresh numbering in each cell? I don't want to use that because I could, theoretically, end up with 10,000 different list styles if the user placed a list in both the Q and A of each of the maximum 5,000 Q and A pairs that the program allows.
Sergey Tkachenko
Site Admin
Posts: 17566
Joined: Sat Aug 27, 2005 10:28 am
Contact:

Post by Sergey Tkachenko »

PS: intervening text was important in MS Word 6 (it has a special command "Skip numbering" to allow numbering to be continued through unnumbered paragraphs; technically it was implemented by inserting an invisible list marker). In MS Word 6, numbering in tables was in up-down order (continued in columns, reset on each column).

Starting from MS Word 97, numbering was changed cardinally, and TRichView's numbering model is more similar to this new one:
- intervening text does not matter;
- numbering in tables is continued first in the same row, then to the next row.
Sergey Tkachenko
Site Admin
Posts: 17566
Joined: Sat Aug 27, 2005 10:28 am
Contact:

Post by Sergey Tkachenko »

If you do not want to create a style for each cell, you can use "reset" property for the first marker in the cell, to reset numbering from 1.
DickBryant
Posts: 148
Joined: Wed Dec 07, 2005 2:02 pm
Contact:

Post by DickBryant »

I agree that maintaining compatibility with MSWord should determine the default behaviour of bullet numbering in TRichViews. It would be nice, though, if an option could be added to the TRichView that would switch to always restarting the bullets from 1. in each cell.
DickBryant
Posts: 148
Joined: Wed Dec 07, 2005 2:02 pm
Contact:

Post by DickBryant »

I'll try your suggestion above, Sergey. Thanks.
DickBryant
Posts: 148
Joined: Wed Dec 07, 2005 2:02 pm
Contact:

Post by DickBryant »

As is often the case, I understand the concept you suggest, but fail to understand how to implement it... :-) I imagine that some code is needed here:

MasterRVTable.Cells[QNumber-1,15].Clear;
MasterRVTable.Cells[QNumber-1,15].InsertRVFFromStream(Stream, 0, Dummy1, Dummy2, Dummy3, False);

placed after the .Clear and before the .InsertRVFFromStream

However, I don't see that the property TRVSeqItemInfo.Reset is supported by Table.Cells[r,c]. Could you clarify?
Sergey Tkachenko
Site Admin
Posts: 17566
Joined: Sat Aug 27, 2005 10:28 am
Contact:

Post by Sergey Tkachenko »

I meant Reset property of the first list marker. You can change it with SetListMarkerInfo (well, it is called UseStartFrom there).
For example:

Code: Select all

for i := 0 to Cell.ItemCount-1 do
  if Cell.GetItemStyle(i)=rvsListMarker then begin
    Cell.GetListMarkerInfo(i,  ListNo, ListLevel, StartFrom, Reset);
    Cell.SetListMarkerInfo(i,  ListNo, ListLevel, 1, True);
    break;
  end;
This example assumes that you have only one paragraph numbering in a cell, otherwise you need to restart all of them.
DickBryant
Posts: 148
Joined: Wed Dec 07, 2005 2:02 pm
Contact:

Post by DickBryant »

Thanks, Sergey. I think it's safe to assume that there's only one numbered list per cell.
DickBryant
Posts: 148
Joined: Wed Dec 07, 2005 2:02 pm
Contact:

Post by DickBryant »

Thanks!! - your sample code fixes the problem perfectly :-)
Post Reply