// create in grid(control) the children of current view public static void AddToGrid(BaseBand obj, MVCxGridViewColumnCollection Columns) { PdfExportHelper pdfHelper = new PdfExportHelper( obj, BaseSettings.GetSystemFont(true)); // at first put bands that were reordered by user // after that put bands that were not reordered by user in pivot order obj.Bands.FindAll(x => !x.IsToDelete).OrderBy(x => x.Order_ForUse).ToList().ForEach(b => AddToGrid(b, Columns, pdfHelper)); // at first put columns that were reordered by user // after that put columns that were not reordered by user in pivot order obj.Columns.FindAll(x => !x.IsToDelete).OrderBy(x => x.Order_ForUse).ToList().ForEach(c => AddToGrid(c, Columns, pdfHelper)); }
public void WordWrappingLowCornerTestCase() { List <PdfExportHelper.CaptionString> captions = new List <PdfExportHelper.CaptionString>(_baseCaptions.ToArray()); captions.Add(new PdfExportHelper.CaptionString("ABC", false, NotUsed)); captions.Add(new PdfExportHelper.CaptionString("Rising US numbers could just", false, NotUsed)); captions.Add(new PdfExportHelper.CaptionString(" ", false, NotUsed)); PdfExportHelper testObject = new PdfExportHelper(new PdfExportHelper.AllCaptionsRetValue(captions.ToArray(), 2), new Font("Arial", 12)); Assert.IsTrue(testObject.ShouldCaptionBeWordWrapped); }
public void WordWrappingHighCornerTestCase() { List <PdfExportHelper.CaptionString> captions = new List <PdfExportHelper.CaptionString>(_baseCaptions.ToArray()); captions.Add(new PdfExportHelper.CaptionString("ABC", false, NotUsed)); captions.Add(new PdfExportHelper.CaptionString("Rising US numbers could just be the tip of the iceberg", false, NotUsed)); captions.Add(new PdfExportHelper.CaptionString("Covid-19 immunity from antibodies may last only months: study", false, NotUsed)); captions.Add(new PdfExportHelper.CaptionString("123456789", false, NotUsed)); captions.Add(new PdfExportHelper.CaptionString("Florida now has more cases than most countries in the world", false, NotUsed)); PdfExportHelper testObject = new PdfExportHelper(new PdfExportHelper.AllCaptionsRetValue(captions.ToArray(), 2), new Font("Arial", 12)); Assert.IsTrue(testObject.ShouldCaptionBeWordWrapped); }
public ActionResult ExportTo(long layoutId, string typeName) { string error; var viewModel = GetModelFromSession(layoutId, out error); if (viewModel == null) { return(View("AvrServiceError", (object)error)); } PdfExportHelper pdfHelper = new PdfExportHelper( viewModel.ViewHeader, BaseSettings.GetSystemFont(true)); pdfHelper.WordWrapVerticalColumnHeaders(viewModel.ViewData); return(LayoutViewHelper.ExportTypes[typeName].Method(LayoutViewHelper.GetGridViewSettings(viewModel.ViewHeader), viewModel.ViewData)); }
private static void SetNewColumn(MVCxGridViewColumn column, AvrViewColumn col, PdfExportHelper pdfHelper) { column.Name = col.UniquePath; column.FieldName = col.UniquePath; column.HeaderStyle.CssClass = "gridColumnHeader"; // link to datasource if (!col.IsAggregate) { if (col.FieldType == typeof(DateTime)) { column.ColumnType = MVCxGridViewColumnType.DateEdit; column.PropertiesEdit.DisplayFormatString = "d"; //col.PrecisionStringWeb; } else //if (col.FieldType == typeof(string)) { column.ColumnType = MVCxGridViewColumnType.TextBox; if (col.FieldType.IsNumeric() && !String.IsNullOrEmpty(col.PrecisionStringWeb)) { column.PropertiesEdit.DisplayFormatString = col.PrecisionStringWeb; } } // sorting if (col.SortOrder.HasValue && col.SortOrder.Value >= 0) { column.SortOrder = col.IsSortAscending ? ColumnSortOrder.Ascending : ColumnSortOrder.Descending; column.SortIndex = col.SortOrder.Value; } } else { // field type column.ColumnType = MVCxGridViewColumnType.TextBox; column.PropertiesEdit.DisplayFormatString = String.IsNullOrEmpty(col.PrecisionStringWeb) ? "" : col.PrecisionStringWeb; // sorting // aggregate columns are unsortable column.Settings.AllowSort = DefaultBoolean.False; } column.Caption = pdfHelper.ProcessString(col.DisplayText); column.ReadOnly = true; // filtration column.Settings.HeaderFilterMode = HeaderFilterMode.List;//CheckedList // visability column.Visible = col.IsVisible; // freesing column.FixedStyle = col.IsFreezed ? GridViewColumnFixedStyle.Left : GridViewColumnFixedStyle.None; // width column.MinWidth = 30; column.Width = Unit.Pixel(col.ColumnWidth); column.CellStyle.HorizontalAlign = HorizontalAlign.Center; }
// create in grid(control) the child - column of current band private static void AddToGrid(AvrViewColumn obj, MVCxGridViewColumnCollection Columns, PdfExportHelper pdfHelper) { Columns.Add(column => { LayoutViewHelper.SetNewColumn(column, obj, pdfHelper); }); }
// create in grid(control) the children of current band // only here we set properties of grid(control) band private static void AddToGrid(AvrViewBand obj, MVCxGridViewColumnCollection Columns, PdfExportHelper pdfHelper) { Columns.AddBand(newband => { newband.Name = obj.UniquePath; newband.Caption = obj.DisplayText; newband.Visible = obj.IsVisible; newband.FixedStyle = obj.IsFreezed ? GridViewColumnFixedStyle.Left : GridViewColumnFixedStyle.None; newband.HeaderStyle.HorizontalAlign = HorizontalAlign.Center; obj.Bands.FindAll(x => !x.IsToDelete).OrderBy(x => x.Order_ForUse).ToList().ForEach(b => AddToGrid(b, newband.Columns, pdfHelper)); obj.Columns.FindAll(x => !x.IsToDelete).OrderBy(x => x.Order_ForUse).ToList().ForEach(c => AddToGrid(c, newband.Columns, pdfHelper)); }); }
public void NoWordWrappingPositiveTestCase() { PdfExportHelper testObject = new PdfExportHelper(new PdfExportHelper.AllCaptionsRetValue(_baseCaptions.ToArray(), 2), new Font("Arial", 12)); Assert.IsFalse(testObject.ShouldCaptionBeWordWrapped); }
public void NoColumnsTestCase() { PdfExportHelper testObject = new PdfExportHelper(new PdfExportHelper.AllCaptionsRetValue(new PdfExportHelper.CaptionString[] { }, 2), new Font("Arial", 12)); Assert.IsFalse(testObject.ShouldCaptionBeWordWrapped); }