Tengo un ListView en mi aplicación WPF que está vinculado a una colección de tareas para realizar (Una lista de tareas). Quiero que el usuario pueda imprimir su lista y haya creado el siguiente código según las pautas de MSDN. (Esta es mi primera incursión en la impresión)Por qué esta tabla de flujo de datos siempre imprime 2 columnas
public FlowDocument GetPrintDocument()
{
FlowDocument flowDoc = new FlowDocument();
Table table = new Table();
int numColumns = 3;
flowDoc.Blocks.Add(table);
for(int x=0;x<numColumns;x++)
{
table.Columns.Add(new TableColumn());
}
GridLengthConverter glc = new GridLengthConverter();
table.Columns[0].Width = (GridLength)glc.ConvertFromString("300");
table.Columns[1].Width = (GridLength)glc.ConvertFromString("50");
table.Columns[2].Width = (GridLength)glc.ConvertFromString("50");
table.RowGroups.Add(new TableRowGroup());
table.RowGroups[0].Rows.Add(new TableRow());
// store current working row for reference
TableRow currentRow = table.RowGroups[0].Rows[0];
currentRow.FontSize = 16;
currentRow.FontWeight = FontWeights.Bold;
currentRow.Cells.Add(new TableCell(new Paragraph(new Run("Subject"))));
currentRow.Cells.Add(new TableCell(new Paragraph(new Run("Due Date"))));
currentRow.Cells.Add(new TableCell(new Paragraph(new Run("Urgency"))));
for (int i = 1; i < issues.Count+1; i++)
{
table.RowGroups[0].Rows.Add(new TableRow());
currentRow = table.RowGroups[0].Rows[i];
currentRow.FontSize = 12;
currentRow.FontWeight = FontWeights.Normal;
currentRow.Cells.Add(new TableCell
(new Paragraph
(new Run
(issues[i - 1].IssSubject))));
currentRow.Cells.Add(new TableCell
(new Paragraph
(new Run
(issues[i - 1].IssDueDate.Date.ToString()))));
currentRow.Cells.Add(new TableCell
(new Paragraph
(new Run
(issues[i - 1].IssUrgency.ToString()))));
}
return flowDoc;
}
Cuando trato de imprimir con el siguiente código Siempre he mi página dividido por la mitad con 2 columnas (cada una contiene las 3 columnas de la tabla). He probado diferentes valores de GridLength pero no tuve éxito.
printDialog.PrintDocument(((IDocumentPaginatorSource)StatusBoardViewModel
.GetPrintDocument())
.DocumentPaginator
,"Flow Document Print Job");
No puedo decirle con qué frecuencia deseé poder ocultar un sitio de mi Resultados de la búsqueda. –