public static Color GetColorProp(byte rplId, StyleAttributeNames styleAttributeName, Color defaultColor, Style styleDef, Dictionary <byte, object> styles) { object obj = null; if (styles != null && styles.TryGetValue(rplId, out obj)) { string text = obj as string; if (text != null) { ReportColor reportColor = new ReportColor(text); return(reportColor.ToColor()); } } ReportColorProperty reportColorProperty = ((StyleBase)styleDef)[styleAttributeName] as ReportColorProperty; if (reportColorProperty != null && !reportColorProperty.IsExpression) { ReportColor value = reportColorProperty.Value; if (value != null) { return(value.ToColor()); } } return(defaultColor); }
public static void ValidateBorderColorNotTransparent(ObjectType objectType, string objectName, AspNetCore.ReportingServices.ReportIntermediateFormat.Style styleClass, string styleName, ErrorContext errorContext) { ReportColor reportColor = default(ReportColor); AspNetCore.ReportingServices.ReportIntermediateFormat.AttributeInfo attributeInfo = default(AspNetCore.ReportingServices.ReportIntermediateFormat.AttributeInfo); if (styleClass.GetAttributeInfo(styleName, out attributeInfo) && !attributeInfo.IsExpression && ReportColor.TryParse(attributeInfo.Value, true, out reportColor) && reportColor.ToColor().A != 255) { errorContext.Register(ProcessingErrorCode.rsInvalidColor, Severity.Error, objectType, objectName, styleName, attributeInfo.Value); } }
protected override void ResetInstanceCache() { if (this.m_style != null) { this.m_style.SetNewContext(); } this.m_separator = null; this.m_separatorColor = null; this.m_toolTip = null; }
protected override void ResetInstanceCache() { if (m_style != null) { m_style.SetNewContext(); } m_caption = null; m_captionEvaluated = false; m_titleSeparator = null; m_titleSeparatorColor = null; }
public ReportColorProperty(bool isExpression, string expressionString, ReportColor value, ReportColor defaultValue) : base(isExpression, expressionString) { if (!isExpression) { this.m_value = value; } else { this.m_value = defaultValue; } }
protected void ExportToPdfMergeRowButton_Click(object sender, EventArgs e) { ReportFactory.SetStyle1ForPDF(); PdfDocument document = new PdfDocument(PageSize.A0); document.PageOrientation = PageOrientation.Landscape; document.InsertFromExcel(MapPath("~/Uploads/Report_4_TongHopCallReport.xlsx")); ReportColor green = ReportColor.Create(0, 100, 45); ReportColor textHong = ReportColor.Create(230, 184, 183); ReportColor textKhds = ReportColor.Create(99, 37, 35); ReportColor textKhln = ReportColor.Create(118, 147, 60); ReportColor textThds = ReportColor.Create(96, 73, 122); ReportColor textThln = ReportColor.Create(49, 134, 155); document.Save(MapPath("~/Uploads/Report_4_TongHopCallReport.pdf"), (paragraphs) => { foreach (IElementRoot paragraph in paragraphs) { if (paragraph is ITable) { ITable table = paragraph as ITable; ITableRow row1 = table.Rows[0]; for (int i = 1; i <= row1.Cells.Count; i++) { ITableCell cell = row1.Cells[i - 1]; cell.BackgoundColor = green; if (i > 3) { cell.TextColor = textHong; } else { cell.TextColor = ReportColor.While; } } ITableRow row3 = table.Rows[2]; for (int i = 1; i <= row3.Cells.Count; i++) { ITableCell cell = row3.Cells[i - 1]; cell.TextColor = ReportColor.While; cell.BackgoundColor = green; } } } return(paragraphs); }); }
protected override void ResetInstanceCache() { m_allowOutSidePlotArea = null; m_calloutBackColor = null; m_calloutLineAnchor = null; m_calloutLineColor = null; m_calloutLineStyle = null; m_calloutLineWidth = null; m_calloutStyle = null; m_showOverlapped = null; m_markerOverlapping = null; m_maxMovingDistance = null; m_minMovingDistance = null; m_disabled = null; }
internal void PopulateStyleInstance(ICompiledStyleInstance styleInstance, bool isParagraphStyle) { if (isParagraphStyle) { TextAlignments textAlign = TextAlign; if (textAlign != 0) { styleInstance.TextAlign = textAlign; } return; } ReportColor color = Color; if (color != null) { styleInstance.Color = color; } string fontFamily = FontFamily; if (!string.IsNullOrEmpty(fontFamily)) { styleInstance.FontFamily = fontFamily; } ReportSize fontSize = FontSize; if (fontSize != null) { styleInstance.FontSize = fontSize; } FontStyles fontStyle = FontStyle; if (fontStyle != 0) { styleInstance.FontStyle = fontStyle; } FontWeights fontWeight = FontWeight; if (fontWeight != 0) { styleInstance.FontWeight = fontWeight; } TextDecorations textDecoration = TextDecoration; if (textDecoration != 0) { styleInstance.TextDecoration = textDecoration; } }
public static ReportColor ToReportColorByRgb(this string rgb) { if (string.IsNullOrEmpty(rgb)) { return(null); } if (rgb.StartsWith("#")) { rgb = rgb.Substring(1); } int argb = int.Parse(rgb, NumberStyles.HexNumber); return(ReportColor.Create(argb)); }
protected override void ResetInstanceCache() { if (m_style != null) { m_style.SetNewContext(); } m_distanceFromScale = null; m_startWidth = null; m_endWidth = null; m_inRangeBarPointerColor = null; m_inRangeLabelColor = null; m_inRangeTickMarksColor = null; m_placement = null; m_toolTip = null; m_hidden = null; m_backgroundGradientType = null; }
protected override void ResetInstanceCache() { if (m_style != null) { m_style.SetNewContext(); } m_min = null; m_max = null; m_crossAt = null; m_visible = null; m_margin = null; m_interval = null; m_intervalType = null; m_intervalOffset = null; m_intervalOffsetType = null; m_labelInterval = null; m_labelIntervalType = null; m_labelIntervalOffset = null; m_labelIntervalOffsetType = null; m_variableAutoInterval = null; m_marksAlwaysAtPlotEdge = null; m_reverse = null; m_location = null; m_interlaced = null; m_interlacedColor = null; m_logScale = null; m_logBase = null; m_hideLabels = null; m_angle = null; m_arrows = null; m_preventFontShrink = null; m_preventFontGrow = null; m_preventLabelOffset = null; m_preventWordWrap = null; m_allowLabelRotation = null; m_includeZero = null; m_labelsAutoFitDisabled = null; m_minFontSize = null; m_maxFontSize = null; m_offsetLabels = null; m_hideEndLabels = null; }
protected override void ResetInstanceCache() { if (m_style != null) { m_style.SetNewContext(); } m_hidden = null; m_position = null; m_layout = null; m_dockOutsideChartArea = null; m_autoFitTextDisabled = null; m_minFontSize = null; m_headerSeparator = null; m_headerSeparatorColor = null; m_columnSeparator = null; m_columnSeparatorColor = null; m_columnSpacing = null; m_interlacedRows = null; m_interlacedRowsColor = null; m_equallySpacedItems = null; m_reversed = null; m_maxAutoSize = null; m_textWrapThreshold = null; }
internal static Color GetColorProp(byte rplId, StyleAttributeNames styleAttributeName, Color defaultColor, Style styleDef, Dictionary <byte, object> styles) { object value = null; if (styles != null && styles.TryGetValue(rplId, out value)) { string text = value as string; if (text != null) { return(new ReportColor(text).ToColor()); } } ReportColorProperty reportColorProperty = styleDef[styleAttributeName] as ReportColorProperty; if (reportColorProperty != null && !reportColorProperty.IsExpression) { ReportColor value2 = reportColorProperty.Value; if (value2 != null) { return(value2.ToColor()); } } return(defaultColor); }
internal static void ValidateBorderColorNotTransparent(ObjectType objectType, string objectName, Microsoft.ReportingServices.ReportIntermediateFormat.Style styleClass, string styleName, ErrorContext errorContext) { if (styleClass.GetAttributeInfo(styleName, out Microsoft.ReportingServices.ReportIntermediateFormat.AttributeInfo styleAttribute) && !styleAttribute.IsExpression && ReportColor.TryParse(styleAttribute.Value, allowTransparency: true, out ReportColor reportColor) && reportColor.ToColor().A != byte.MaxValue) { errorContext.Register(ProcessingErrorCode.rsInvalidColor, Severity.Error, objectType, objectName, styleName, styleAttribute.Value); } }
protected override void ResetInstanceCache() { this.m_color = null; this.m_scaleFactor = null; this.m_indicatorStyle = null; }
protected void ExportToPdfMergeRowButton_Click(object sender, EventArgs e) { ReportFactory.SetStyle1ForPDF(); PdfDocument document = new PdfDocument(PageSize.A0); document.PageOrientation = PageOrientation.Landscape; //ITable table = document.NewTable(3); //ITableRow row1 = table.NewRow(); //row1.BackgoundColor = ReportColor.Red; //row1.TextColor = ReportColor.While; //ITableCell r1c123 = row1.NewCell(); //r1c123.Value = "R1C1 - R2C1 - R3C1"; //r1c123.HorizontalAlignment = HorizontalAlignment.Center; //r1c123.VerticalAlignment = VerticalAlignment.Middle; //r1c123.Rowspan = 3; //ITableCell r1c2 = row1.NewCell(); //r1c2.Value = "R1C2"; //ITableCell r1c3 = row1.NewCell(); //r1c3.Value = "R1C3"; //ITableRow row2 = table.NewRow(); //ITableCell r2c23 = row2.NewCell(); //r2c23.Colspan = 2; //r2c23.Value = "R2C2 - R2C3"; ////ITableCell r2c3 = row2.NewCell(); ////r2c3.Value = "R2C3"; //ITableRow row3 = table.NewRow(); //ITableCell r3c2 = row3.NewCell(); //r3c2.Value = "R3C2"; //ITableCell r3c3 = row3.NewCell(); //r3c3.Value = "R3C3"; document.InsertFromExcel(MapPath("~/Uploads/data_merge_row.xlsx")); ReportColor green = ReportColor.Create(0, 100, 45); ReportColor textHong = ReportColor.Create(230, 184, 183); ReportColor textKhds = ReportColor.Create(99, 37, 35); ReportColor textKhln = ReportColor.Create(118, 147, 60); ReportColor textThds = ReportColor.Create(96, 73, 122); ReportColor textThln = ReportColor.Create(49, 134, 155); document.Save(MapPath("~/Uploads/data_merge_row.pdf"), (paragraphs) => { foreach (IElementRoot paragraph in paragraphs) { if (paragraph is ITable) { ITable table = paragraph as ITable; ITableRow row1 = table.Rows[0]; for (int i = 1; i <= row1.Cells.Count; i++) { ITableCell cell = row1.Cells[i - 1]; cell.BackgoundColor = green; if (i >= 3) { cell.TextColor = textHong; } else { cell.TextColor = ReportColor.While; } } ITableRow row4 = table.Rows[3]; for (int i = 1; i <= row4.Cells.Count; i++) { ITableCell cell = row4.Cells[i - 1]; cell.TextColor = ReportColor.While; if (i <= 10) { cell.BackgoundColor = green; } else if (i == 11) { cell.BackgoundColor = textKhds; } else if (i == 12) { cell.BackgoundColor = textKhln; } else if (i == 13) { cell.BackgoundColor = textThds; } else if (i == 14) { cell.BackgoundColor = textThln; } } ITableRow row5 = table.Rows[4]; for (int i = 1; i <= row5.Cells.Count; i++) { ITableCell cell = row5.Cells[i - 1]; cell.TextColor = ReportColor.While; if (i <= 11) { cell.BackgoundColor = textKhds; } else if (i <= 18) { cell.BackgoundColor = textKhln; } else if (i <= 29) { cell.BackgoundColor = textThds; } else { cell.BackgoundColor = textThln; } } } } return(paragraphs); }); }
protected override void ResetInstanceCache() { m_color = null; }
public BorderItem(int?width, BorderStyle style, ReportColor color) { Width = width; Style = style; Color = color; }
// Accesses the data saved with the custom report item in the design environment and // creates the custom report items image that will be rendered on the report. private byte[] DrawImage(CustomReportItem customReportItem) { int dpi = 96; int imageWidth = (int)(customReportItem.Width.ToInches() * dpi); int imageHeight = (int)(customReportItem.Height.ToInches() * dpi); System.Drawing.Bitmap image = new System.Drawing.Bitmap(imageWidth, imageHeight); System.Drawing.Graphics graphics = System.Drawing.Graphics.FromImage(image); System.Drawing.Color backgroundColor = customReportItem.Style.BackgroundColor.Value.ToColor(); if (backgroundColor == System.Drawing.Color.Transparent) { backgroundColor = System.Drawing.Color.White; } graphics.Clear(backgroundColor); int maxX = (int)LookupCustomProperty(customReportItem.CustomProperties, "poly:MaxX", 100); int maxY = (int)LookupCustomProperty(customReportItem.CustomProperties, "poly:MaxY", 100); int minX = (int)LookupCustomProperty(customReportItem.CustomProperties, "poly:MinX", 0); int minY = (int)LookupCustomProperty(customReportItem.CustomProperties, "poly:MinY", 0); float scaleX = imageWidth / (float)(maxX - minX); float scaleY = imageHeight / (float)(maxY - minY); string proportional = (string)LookupCustomProperty(customReportItem.CustomProperties, "poly:Proportional", bool.FalseString); if ((string)proportional == bool.TrueString) { if (scaleX > scaleY) scaleX = scaleY; else scaleY = scaleX; } string transString = (string)LookupCustomProperty(customReportItem.CustomProperties, "poly:Translucency", "Opaque"); int translucency = 255; switch (transString) { case "Opaque": translucency = 255; break; case "Translucent": translucency = 128; break; case "Transparent": translucency = 32; break; } CustomData customData = customReportItem.CustomData; // Iterate over the Shapes foreach (DataMember shape in customData.DataRowHierarchy.MemberCollection) { // Get the Points for drawing the shapes List<System.Drawing.Point> points = new List<System.Drawing.Point>(); System.Drawing.Brush brush = new System.Drawing.SolidBrush(System.Drawing.Color.Black); DataDynamicMemberInstance shapeInstance = (DataDynamicMemberInstance)shape.Instance; while (shapeInstance.MoveNext()) { points.Clear(); // Get the Color for the Shape string colorname = (string)LookupCustomProperty(shape.CustomProperties, "poly:Color", "Black"); ReportColor rptColor = new ReportColor(colorname); System.Drawing.Color color = System.Drawing.Color.FromArgb(translucency, rptColor.ToColor()); brush = new System.Drawing.SolidBrush(color); // Get the Hyperlink value if one has been assigned string hyperlink = (string)LookupCustomProperty(shape.CustomProperties, "poly:Hyperlink", ""); // Iterate over the Points foreach (DataMember point in shape.Children) { DataDynamicMemberInstance pointInstance = (DataDynamicMemberInstance)point.Instance; while (pointInstance.MoveNext()) { for (int i = 0; i < customData.RowCollection.Count; i++) { DataRow row = customData.RowCollection[i]; int x = (int)LookupDataValue(row, "X", 0); int y = (int)LookupDataValue(row, "Y", 0); x = (int)((x - minX) * scaleX); y = (int)((y - minY) * scaleY); points.Add(new System.Drawing.Point(x, y)); } } } // Create the Hyperlink Actions if (!string.IsNullOrEmpty(hyperlink)) { // Build the coordinates for the Hyperlink Actions float[] coordinates = new float[points.Count * 2]; for (int i = 0; i < points.Count; i++) { System.Drawing.Point point = points[i]; coordinates[i * 2] = (100 * point.X) / imageWidth; coordinates[i * 2 + 1] = (100 * point.Y) / imageHeight; } Image polygonImage = (Image)customReportItem.GeneratedReportItem; ActionInfoWithDynamicImageMap imageMap = polygonImage.ImageInstance.CreateActionInfoWithDynamicImageMap(); Action action = imageMap.CreateHyperlinkAction(); action.Instance.HyperlinkText = hyperlink; imageMap.CreateImageMapAreaInstance(ImageMapArea.ImageMapAreaShape.Polygon, coordinates); } // Draw the image graphics.FillPolygon(brush, points.ToArray()); } } MemoryStream stream = new MemoryStream(); image.Save(stream, ImageFormat.Bmp); byte[] imageData = new byte[(int)stream.Length]; stream.Seek(0, SeekOrigin.Begin); stream.Read(imageData, 0, (int)stream.Length); return imageData; }