Hello.
How can I insert a table at the beginning of a new page.
I use the code from the example to insert the table.
C#if (e.VariableName == "MyCustomInsertTableField")
{
System.Data.DataTable dataTable = T589084.Models.MyModel.GetDT1();
DevExpress.XtraRichEdit.RichEditDocumentServer docServer = new DevExpress.XtraRichEdit.RichEditDocumentServer();
string PageBreak = new string('\u000C', 1);
int dataTableRows = dataTable.Rows.Count;
int dataTableColumns = dataTable.Columns.Count;
DevExpress.XtraRichEdit.API.Native.Table table = docServer.Document.Tables.Create(docServer.Document.Range.End, dataTableRows + 1, dataTableColumns);
for (int i = 0; i < dataTableColumns; i++)
{
docServer.Document.InsertText(table[0, i].Range.Start, dataTable.Columns[i].ColumnName);
}
table.ForEachCell(delegate (DevExpress.XtraRichEdit.API.Native.TableCell cell, int rowIndex, int cellIndex)
{
if (rowIndex > 0)
{
docServer.Document.InsertText(cell.Range.Start, dataTable.Rows[rowIndex - 1][dataTable.Columns[cellIndex].ColumnName].ToString());
}
});
e.Value = docServer.Document;
e.Handled = true;
}
};
Tried to do so
C#docServer.Document.AppendText(new string('\u000C', 1));
JavaScriptrichEdit.Document.CaretPosition = richEdit.Document.Range.End;
Tell me how to implement this behavior?
Thanks!