i need some help in this issue:
i save to sql data base the text from editor ajaxcontrol. the users insert some text and when i select the data table return something like this:
<table> <tbody> <tr> <td> <p>Proposta</p></td> <td> <p>2015_DRC_NOR_000098_S01</p></td></tr> <tr> <td> <p style="font-weight: bold">Montante da Proposta</p></td> <td> <p>14384,86 €</p></td></tr> <tr> <td> <p style="font-weight: bold">Prazo</p></td> <td> <p>33</p></td></tr> <tr> <td> <p style="font-weight: bold">Nº de prestações</p></td> <td> <p>33</p></td></tr> <tr> <td> <p style="font-weight: bold">Periodicidade</p></td> <td> <p>Mensal</p></td></tr> <tr> <td> <p style="font-weight: bold">Prazo de carência de capital</p></td> <td> <p>0</p></td></tr> <tr> <td> <p style="font-weight: bold">Carência de Juros</p></td> <td> <p>Sem carência</p></td></tr> <tr> <td> <p style="font-weight: bold">Taxa de juro pré-acordo</p></td> <td> <p>7,050 %</p></td></tr> <tr> <td> <p style="font-weight: bold">Taxa de juro acordo</p></td> <td> <p>7,050 %</p></td></tr> <tr> <td> <p style="font-weight: bold">Outras condições</p></td> <td> <p>Reforço de garantias</p> <p>Pagamento prévio das FT vencidas</p> <p>Execução do penhor de ações</p></td></tr></tbody></table>
I need to put this text (table html) in the middle of the template but when i test your example, it only put it on the end of the document.
- Code: Select all
Dim ptpclass As PTP = New PTP
Dim DS As DataTable = New DataTable
DS = ptpclass.ListarPTP(codigo).Tables(0)
Dim document As New Document("S:\Projectos\DRC\Templates\Summary_of_Science.doc")
'document.Replace("science", tempDoc, false, true);
Dim replacement As IList(Of Paragraph) = New List(Of Paragraph)()
'Dim p1 As New Paragraph(document)
'p1.AppendText(DS.Rows(0)(1).ToString)
'Dim p2 As New Paragraph(document)
'p2.AppendText(DS.Rows(0)(2).ToString)
'Dim p3 As New Paragraph(document)
'p3.AppendText(DS.Rows(0)(3).ToString)
'replacement.Add(p1)
'replacement.Add(p2)
'replacement.Add(p3)
'the html represents two paragraphs, we create a temp section to contains them
'Dim tempSection As Section = document.AddSection()
'Dim p4 As Paragraph = tempSection.AddParagraph()
'p4.AppendHTML("<p style='text-align: Right'><span style='background-color: yellow'><i><b>here is the topic text for Governing Body Oversight</b></i></span></p><p style='text-align: left'><span style='background-color: yellow'><i><b> fdsafds</b></i></span></p>")
'For Each tempP In tempSection.Paragraphs
' replacement.Add(tempP)
'Next
Dim tempSection1 As Section = document.AddSection()
Dim p41 As Paragraph = tempSection1.AddParagraph()
Dim z As String = DS.Rows(0)(5).ToString
p41.AppendHTML(z)
For Each tempP In tempSection1.Paragraphs
replacement.Add(tempP)
Next
Dim selections As TextSelection() = document.FindAllString("Situacao", False, True)
Dim locations As New List(Of TextRangeLocation)()
For Each selection As TextSelection In selections
locations.Add(New TextRangeLocation(selection.GetAsOneRange()))
Next
locations.Sort()
For Each location As TextRangeLocation In locations
Replace(location, replacement)
Next
note: it isn't necessary the while because i only need to replace 1 string.
i have tryed with bookmark and the problem is the same.
could you help me?
Thank you very mush