How do I place text and graphics side-by-side?
I got it working using a Site object, but the problem is that it uses absolute positioning. If the paragraph text is twice as long, you get overlap.
Hi How do I add this checkbox image into cell 2 of the Table below.
Thanks
Infragistics.Documents.Reports.Report.Table.ITableRow tableRow; Infragistics.Documents.Reports.Report.Table.ITableCell tableCell; tableRow = table.AddRow();
tableCell = tableRow.AddCell(); tableCell.Width = new RelativeWidth(50); //theTableCell.Height = new RelativeHeight(30); //theTableCell.Height = new RelativeHeight(30); tableCellPattern.Apply(tableCell); // tableCell.Background = new Background(Brushes.LightSlateGray); IText tableCellText = tableCell.AddText(); tableCellText.Alignment = new TextAlignment(Alignment.Center, Alignment.Middle); tableCellText.AddContent("'Column' Span 1k "); tableCellText.AddContent("'Column' Span 1k"); tableCellText.AddContent(" 'Column' Span 1k");
tableCell = tableRow.AddCell(); tableCell.Width = new RelativeWidth(50); //theTableCell.Height = new RelativeHeight(30); tableCellPattern.Apply(tableCell); tableCellText = tableCell.AddText(); tableCellText.Alignment = new TextAlignment(Alignment.Center, Alignment.Middle); tableCellText.AddContent("Cell 2"); theTableCell.AddImage(new Infragistics.Documents.Reports.Graphics.Image(Server.MapPath("/Image/checkbox.png")));
One solution is to use a Table, with the text in the first cell and the image in the second (or vice versa), such as:
Report r = new Report();ISection section = r.AddSection();ITable table = section.AddTable();ITableRow row = table.AddRow();row.AddCell().AddText().AddContent("This is a really long string that isn't particularly interesting to read yet should illustrate the purpose of using a table to get text and an image on the same line");row.AddCell().AddImage(new Infragistics.Documents.Graphics.Image("test.PNG"));
You can set the width of a particular cell as necessary using FixedWidth or RelativeWidth. Additionally, if you want to have multiple lines like this all with the same width per cell in a column, you could look into the Grid object.
-Matt