Example #1
0
    private ItemRectangle GetItemRectangle(JQClientTools.JQReportItem item)
    {
        var left = 0.0;
        for (int i = 0; i < item.ColumnIndex; i++)
        {
            left += GetColumnWidth(i);
        }

        var top = 0.0;
        for (int i = 0; i < item.RowIndex; i++)
        {
            top += ROW_HEIGHT;
        }

        var width = 0.0;
        var cells = item.Cells;
        if (cells == 0)
        {
            cells = 1;
        }
        for (int i = item.ColumnIndex; i < item.ColumnIndex + cells; i++)
        {
            width += GetColumnWidth(i);
        }

        var height = ROW_HEIGHT;
        return new ItemRectangle() { Height = height, Left = left, Top = top, Width = width };
    }
Example #2
0
    private string GetItemExpression(JQClientTools.JQReportItem item)
    {
        var format = item.Format;
        var caption = item.Caption;
        if (item is JQClientTools.JQReportConstantItem)
        {
            var expression = string.Empty;
            switch ((item as JQClientTools.JQReportConstantItem).Style)
            {
                case JQClientTools.JQReportConstantItem.StyleType.CompanyName:
                case JQClientTools.JQReportConstantItem.StyleType.QueryCondition:
                case JQClientTools.JQReportConstantItem.StyleType.ReportDate:
                case JQClientTools.JQReportConstantItem.StyleType.ReportDateTime:
                case JQClientTools.JQReportConstantItem.StyleType.UserID:
                case JQClientTools.JQReportConstantItem.StyleType.UserName:
                case JQClientTools.JQReportConstantItem.StyleType.Logo:
                    expression = string.Format("Parameters!{0}.Value", (item as JQClientTools.JQReportConstantItem).Style);
                    break;
                case JQClientTools.JQReportConstantItem.StyleType.PageIndex:
                    expression = "Globals!PageNumber.ToString()";
                    break;
                case JQClientTools.JQReportConstantItem.StyleType.PageIndexAndTotal:
                    expression = @"Globals!PageNumber.ToString()+""/""+Globals!TotalPages.ToString()";
                    break;
                case JQClientTools.JQReportConstantItem.StyleType.Description:
                    expression = "\"" + Report.Description + "\"";
                    break;
                case JQClientTools.JQReportConstantItem.StyleType.ReportID:
                    expression = "\"" + Report.ReportID + "\"";
                    break;
                case JQClientTools.JQReportConstantItem.StyleType.ReportName:
                    expression = "\"" + Report.ReportName + "\"";
                    break;
            }

            if ((item as JQClientTools.JQReportConstantItem).Style == JQClientTools.JQReportConstantItem.StyleType.Logo)
            {
                format = string.Empty;
                caption = string.Empty;
            }
            if (!string.IsNullOrEmpty(format) && format.Contains("{0}"))
            {
                return GetFormatExpression(expression, format, false);
            }
            else
            {
                if (!string.IsNullOrEmpty(caption))
                {
                    format = caption + "{0}";
                }
                return GetFormatExpression(expression, format, false);
            }

            //return GetFormatExpression(expression, format, false);

        }
        else if (item is JQClientTools.JQReportFieldItem)
        {
            var expression = string.Format("First(Fields!{0}.Value, \"{1}\")", (item as JQClientTools.JQReportFieldItem).Field, Report.HeaderDataSetName);
            if (!string.IsNullOrEmpty(format) && format.Contains("{0}"))
            {
                return GetFormatExpression(expression, format, true);
            }
            else
            {
                if (!string.IsNullOrEmpty(format))
                {
                    expression = string.Format("Format({0}, \"{1}\")", expression, format);
                }

                if (!string.IsNullOrEmpty(caption))
                {
                    format = caption + "{0}";
                }
                return GetFormatExpression(expression, format, true);
            }
        }
        return string.Empty;
    }
Example #3
0
 private JQClientTools.JQReportFieldItem GetChildGroup(List<JQClientTools.JQReportFieldItem> groupItems, JQClientTools.JQReportFieldItem parentGroupItem)
 {
     var index = groupItems.IndexOf(parentGroupItem);
     if (groupItems.Count > index + 1)
     {
         return groupItems[index + 1];
     }
     else
     {
         return null;
     }
 }
Example #4
0
    private void AppendTotalCaption(List<JQClientTools.JQReportFieldItem> groupItems, JQClientTools.JQReportFieldItem groupItem, XmlWriter writer)
    {
        writer.WriteStartElement(TABLIXHEADER_ELEMENT); //<TablixHeader>
        var width = groupItem.Width * 0.039;
        AppendString(writer, SIZE_ELEMENT, string.Format("{0}cm", width));//<Size/>
        writer.WriteStartElement(CELLCONTENTS_ELEMENT); //<CellContents>
        if (groupItem.GroupFor == "Count" || groupItem.GroupFor == "LineFeed")
        {
            AppendTextBox(writer, string.Format("TotalLabel{0}", groupItem.GroupFor), string.Empty, GetItemStyle(groupItem.HeaderFont, "Black", string.Empty, string.Empty, null, 0), null);
        }
        else
        {
            AppendTextBox(writer, string.Format("TotalLabel{0}", groupItem.Field), Report.TotalCaption, GetItemStyle(groupItem.HeaderFont, groupItem.HeaderColor, groupItem.BackColor, groupItem.HeaderAlignment, null, Report.DetailBorderWidth), null);
        }
        writer.WriteEndElement(); //</CellContents>
        writer.WriteEndElement(); //</TablixHeader>

        var childgroup = GetChildGroup(groupItems, groupItem);
        if (childgroup != null)
        {
            if (groupItem.GroupFor == "Count" || groupItem.GroupFor == "LineFeed") { }
            else
            {
                Report.TotalCaption = string.Empty;
            }
            writer.WriteStartElement(TABLIXMEMBERS_ELEMENT); //<TablixMembers>
            writer.WriteStartElement(TABLIXMEMBER_ELEMENT); //<TablixMember>
            AppendTotalCaption(groupItems, childgroup, writer);
            writer.WriteEndElement(); //</TablixMember>
            writer.WriteEndElement(); //</TablixMembers>
        }
    }
Example #5
0
    private void AppendGroupLineFeed(List<JQClientTools.JQReportFieldItem> groupItems, JQClientTools.JQReportFieldItem groupItem, XmlWriter writer)
    {
        writer.WriteStartElement(TABLIXHEADER_ELEMENT); //<TablixHeader>
        var width = groupItem.Width * 0.039;
        AppendString(writer, SIZE_ELEMENT, string.Format("{0}cm", width));//<Size/>
        writer.WriteStartElement(CELLCONTENTS_ELEMENT); //<CellContents>

        AppendTextBox(writer, string.Format("GroupLineFeedText{0}", groupItem.Field), string.Empty, GetItemStyle(groupItem.HeaderFont, "Black", string.Empty, string.Empty, null, 0), null);

        writer.WriteEndElement(); //</CellContents>
        writer.WriteEndElement(); //</TablixHeader>

        var childgroup = GetChildGroup(groupItems, groupItem);
        if (childgroup != null)
        {
            writer.WriteStartElement(TABLIXMEMBERS_ELEMENT); //<TablixMembers>
            writer.WriteStartElement(TABLIXMEMBER_ELEMENT); //<TablixMember>
            AppendGroupLineFeed(groupItems, childgroup, writer);
            writer.WriteEndElement(); //</TablixMember>
            writer.WriteEndElement(); //</TablixMembers>
        }
    }
Example #6
0
    private void AppendGroupContent(List<JQClientTools.JQReportFieldItem> groupItems, JQClientTools.JQReportFieldItem groupItem, XmlWriter writer)
    {
        writer.WriteStartElement(GROUP_ELEMENT); //<Group>
        writer.WriteAttributeString(NAME_PROPERTY, string.Format("Group{0}", groupItem.GroupFor == null? groupItem.Field : groupItem.GroupFor));
        writer.WriteStartElement(GROUPEXPRESSIONS_ELEMENT); //<GroupExpressions>
        if (groupItem.GroupFor == "Count")
        {
            AppendString(writer, GROUPEXPRESSION_ELEMENT, string.Format("=Int((RowNumber(Nothing)-1)/{0})", Report.DetailCount));//<GroupExpression/>
        }
        else
        {
            AppendString(writer, GROUPEXPRESSION_ELEMENT, string.Format("=Fields!{0}.Value", groupItem.Field));//<GroupExpression/>
        }
        writer.WriteEndElement(); //</GroupExpressions>
        if (Report.GroupStyle == JQClientTools.GroupStyle.ChangePage && groupItems.IndexOf(groupItem) <= 0)
        {
            writer.WriteStartElement(PAGEBREAK_ELEMENT); //<PageBreak>
            AppendString(writer, BREAKLOCATION_ELEMENT, "Between");//<Value/>
            writer.WriteEndElement(); //</PageBreak>
        }

        writer.WriteEndElement(); //</Group>
        if (groupItem.GroupFor == "Count") { }
        else
        {
            writer.WriteStartElement(SORTEXPRESSIONS_ELEMENT); //<SortExpressions>
            writer.WriteStartElement(SORTEXPRESSION_ELEMENT); //<SortExpression>
            AppendString(writer, VALUE_ELEMENT, string.Format("=Fields!{0}.Value", groupItem.Field));//<Value/>
            writer.WriteEndElement(); //</SortExpression>
            writer.WriteEndElement(); //</SortExpressions>
        }

        writer.WriteStartElement(TABLIXHEADER_ELEMENT); //<TablixHeader>
        var width = groupItem.Width * 0.039;
        AppendString(writer, SIZE_ELEMENT, string.Format("{0}cm", width));//<Size/>
        writer.WriteStartElement(CELLCONTENTS_ELEMENT); //<CellContents>
        if (groupItem.GroupFor == "Count" || groupItem.GroupFor == "LineFeed")
        {
            AppendTextBox(writer, string.Format("GroupText{0}", groupItem.GroupFor), string.Empty, GetItemStyle(Report.DetailFont, "Black", string.Empty, string.Empty, null, 0), null);
        }
        else
        {
            AppendTextBox(writer, string.Format("GroupText{0}", groupItem.Field), GetFormatExpression(string.Format("Fields!{0}.Value", groupItem.Field), null, true), GetItemStyle(groupItem.Font, groupItem.Color, groupItem.BackColor, groupItem.Alignment, groupItem.Format, Report.DetailBorderWidth), null);
        }

        writer.WriteEndElement(); //</CellContents>
        writer.WriteEndElement(); //</TablixHeader>

        writer.WriteStartElement(TABLIXMEMBERS_ELEMENT); //<TablixMembers>
        writer.WriteStartElement(TABLIXMEMBER_ELEMENT); //<TablixMember>
        var childgroup = GetChildGroup(groupItems, groupItem);
        if (childgroup != null)
        {
            AppendGroupContent(groupItems, childgroup, writer);
        }
        else
        {
            writer.WriteStartElement(GROUP_ELEMENT); //<Group>
            writer.WriteAttributeString(NAME_PROPERTY, "Detail");
            writer.WriteEndElement(); //</Group>
            var detailRowCount = DetailRowCount;
            if (detailRowCount > 1)
            {
                writer.WriteStartElement(TABLIXMEMBERS_ELEMENT); //<TablixMembers>
                for (int i = 0; i < detailRowCount; i++)
                {
                    writer.WriteStartElement(TABLIXMEMBER_ELEMENT); //<TablixMember>
                    writer.WriteEndElement(); //</TablixMember>
                }
                writer.WriteEndElement(); //</TablixMembers>
            }
        }
        writer.WriteEndElement(); //</TablixMember>

        if (HasGroupTotal())
        {
            if ((groupItems.IndexOf(groupItem) == 0 && groupItems[0].GroupFor != "LineFeed")
                || (groupItems.IndexOf(groupItem) == 1 && groupItems[0].GroupFor == "LineFeed"))
            {
                writer.WriteStartElement(TABLIXMEMBER_ELEMENT); //<TablixMember>
                AppendString(writer, KEEPWITHGROUP_ELEMENT, "Before"); //<KeepWithGroup/>
                writer.WriteEndElement(); //</TablixMember>

            }
        }
        if (groupItem.GroupFor == "LineFeed")
        {
            childgroup = GetChildGroup(groupItems, groupItem);
            if (childgroup != null)
            {
                writer.WriteStartElement(TABLIXMEMBER_ELEMENT); //<TablixMember>
                AppendGroupLineFeed(groupItems, childgroup, writer);
                AppendString(writer, KEEPWITHGROUP_ELEMENT, "Before"); //<KeepWithGroup/>
                writer.WriteEndElement(); //</TablixMember>
            }
        }

        writer.WriteEndElement(); //</TablixMembers>
    }