private void button1_Click(object sender, EventArgs e) { RichEditDocumentServer server = new RichEditDocumentServer(); server.LoadDocument("fish.rtf"); DocumentRange[] ranges = server.Document.FindAll(DevExpress.Office.Characters.PageBreak.ToString(), DevExpress.XtraRichEdit.API.Native.SearchOptions.None); DocumentPosition dp = server.Document.Paragraphs[0].Range.Start; List <MyRtfObject> collection = new List <MyRtfObject>(); foreach (DocumentRange dr in ranges) { DocumentRange tmpRange = server.Document.CreateRange(dp, dr.Start.ToInt() - dp.ToInt()); collection.Add(new MyRtfObject() { RtfSplitContent = server.Document.GetRtfText(tmpRange) }); dp = dr.End; } DocumentRange tmpRange2 = server.Document.CreateRange(dp, server.Document.Paragraphs[server.Document.Paragraphs.Count - 1].Range.End.ToInt() - dp.ToInt()); collection.Add(new MyRtfObject() { RtfSplitContent = server.Document.GetRtfText(tmpRange2) }); XtraReport1 report = new XtraReport1(); report.DataSource = collection; report.ShowPreviewDialog(); }
private void simpleButton1_Click(object sender, EventArgs e) { List <Data> list = new List <Data>(); Random random = new Random(); for (int i = 0; i < 10; i++) { Data data = new Data(string.Format("Name {0}", i), string.Format("Category {0}", random.Next(4)), random.Next(1000)); list.Add(data); } XtraReport1 report = new XtraReport1(); report.DataSource = list; report.ShowPreviewDialog(); }
private void button1_Click(object sender, EventArgs e) { List <MyObj> myItems = new List <MyObj>(); OpenFileDialog ofd = new OpenFileDialog(); ofd.Multiselect = true; ofd.Filter = "VCard|*.vcf|All|*.*"; if (ofd.ShowDialog() == System.Windows.Forms.DialogResult.OK) { foreach (string s in ofd.FileNames) { myItems.Add(new MyObj() { Path = s, Vcard = File.ReadAllBytes(s) }); } XtraReport1 report = new XtraReport1(); report.DataSource = myItems; report.ShowPreviewDialog(); } }