I am creating a flowdocument that consists of several records. Each entry contains two tables at the top, and then some rich text that I exit the database. The code that adds rich text is below (cp.Comments contains text labeled rtf).
Dim tr As TextRange Dim arr() As Byte Using ms As New System.IO.MemoryStream arr = (New System.Text.UTF8Encoding).GetBytes(cp.Comments) ms.Write(arr, 0, arr.Length) ms.Seek(0, IO.SeekOrigin.Begin) tr = New TextRange(fd.ContentEnd, fd.ContentEnd) 'add to end tr.Load(ms, DataFormats.Rtf) End Using
Flowdocument correctly displays the first record, but all subsequent records are rendered with a gap between the first and second tables. The strangest thing is that I present 2 tables before importing RTF, but RTF somehow affects the spacing between the tables.
fd = new FlowDocument for each cp in SomeCollection fdtemp = New FlowDocument CreateFirstTable(cp, fdtemp) CreateSecondTable(cp, fdtemp) AddRTF(cp, fdtemp) FlowDocumentUtils.AddDocument(fdtemp, fd) next
The problem is not related to the data in the first element of the collection - if I say that the rendering skips rendering of the first record, then the second record is displayed normally, and the rest contain an additional interval.
Note: the problem is definitely related to inserting rich text - if I comment on the AddRTF call, then all the tables will be displayed correctly together. (value for the fields of the table is (0,0,0,0))
Has anyone seen this?
taglius
source share