Esempio n. 1
0
 /// <summary>
 /// Draw any custom controls.
 /// </summary>
 /// <param name="e"></param>
 public void OnCustomDraw(CustomDrawEventArgs e)
 {
     if (CustomDraw != null)
     {
         CustomDraw(this, e);
     }
 }
        private void LayerTable(FastString Page, FastString CSS, TableBase table)
        {
            float y = 0;

            for (int i = 0; i < table.RowCount; i++)
            {
                float x = 0;
                for (int j = 0; j < table.ColumnCount; j++)
                {
                    if (!table.IsInsideSpan(table[j, i]))
                    {
                        TableCell textcell = table[j, i];

                        textcell.Left = x;
                        textcell.Top  = y;

                        // custom draw
                        CustomDrawEventArgs e = new CustomDrawEventArgs();
                        e.report       = Report;
                        e.reportObject = textcell;
                        e.layers       = Layers;
                        e.zoom         = Zoom;
                        e.left         = textcell.AbsLeft;
                        e.top          = hPos + textcell.AbsTop;
                        e.width        = textcell.Width;
                        e.height       = textcell.Height;
                        OnCustomDraw(e);
                        if (e.done)
                        {
                            CSS.Append(e.css);
                            Page.Append(e.html);
                        }
                        else
                        {
                            if (textcell is TextObject && !(textcell as TextObject).TextOutline.Enabled && IsMemo(textcell))
                            {
                                LayerText(Page, textcell as TextObject);
                            }
                            else
                            {
                                LayerBack(Page, textcell as ReportComponentBase, null);
                                LayerPicture(Page, textcell as ReportComponentBase, null);
                            }
                        }
                    }
                    x += (table.Columns[j]).Width;
                }
                y += (table.Rows[i]).Height;
            }
        }
        private void ExportBandLayers(Base band)
        {
            LayerBack(htmlPage, band as ReportComponentBase, null);
            foreach (Base c in band.ForEachAllConvectedObjects(this))
            {
                if (c is ReportComponentBase && (c as ReportComponentBase).Exportable)
                {
                    ReportComponentBase obj = c as ReportComponentBase;

                    // custom draw
                    CustomDrawEventArgs e = new CustomDrawEventArgs();
                    e.report       = Report;
                    e.reportObject = obj;
                    e.layers       = Layers;
                    e.zoom         = Zoom;
                    e.left         = obj.AbsLeft;
                    e.top          = hPos + obj.AbsTop;
                    e.width        = obj.Width;
                    e.height       = obj.Height;

                    OnCustomDraw(e);
                    if (e.done)
                    {
                        css.Append(e.css);
                        htmlPage.Append(e.html);
                    }
                    else
                    {
                        if (!String.IsNullOrEmpty(obj.Bookmark))
                        {
                            htmlPage.Append("<a name=\"").Append(obj.Bookmark).Append("\"></a>");
                        }

                        if (obj is CellularTextObject)
                        {
                            obj = (obj as CellularTextObject).GetTable();
                        }
                        if (obj is TableCell)
                        {
                            continue;
                        }
                        else if (obj is TableBase)
                        {
                            TableBase table = obj as TableBase;
                            if (table.ColumnCount > 0 && table.RowCount > 0)
                            {
                                using (TextObject tableback = new TextObject())
                                {
                                    tableback.Border    = table.Border;
                                    tableback.Fill      = table.Fill;
                                    tableback.FillColor = table.FillColor;
                                    tableback.Left      = table.AbsLeft;
                                    tableback.Top       = table.AbsTop;
                                    float tableWidth  = 0;
                                    float tableHeight = 0;
                                    for (int i = 0; i < table.ColumnCount; i++)
                                    {
                                        tableWidth += table[i, 0].Width;
                                    }
                                    for (int i = 0; i < table.RowCount; i++)
                                    {
                                        tableHeight += table.Rows[i].Height;
                                    }
                                    tableback.Width  = (tableWidth < table.Width) ? tableWidth : table.Width;
                                    tableback.Height = tableHeight;
                                    LayerText(htmlPage, tableback);
                                }
                                LayerTable(htmlPage, css, table);
                            }
                        }
                        else if (IsMemo(obj))
                        {
                            LayerText(htmlPage, obj as TextObject);
                        }
                        else if (obj is HtmlObject)
                        {
                            LayerHtml(htmlPage, obj as HtmlObject);
                        }
                        else if (obj is BandBase)
                        {
                            LayerBack(htmlPage, obj, null);
                        }
                        else if (obj is LineObject)
                        {
                            LayerPicture(htmlPage, obj, null);
                        }
                        else if (obj is ShapeObject && ((obj as ShapeObject).Shape == ShapeKind.Rectangle || (obj as ShapeObject).Shape == ShapeKind.RoundRectangle))
                        {
                            LayerShape(htmlPage, obj as ShapeObject, null);
                        }
                        else if (HasExtendedExport(obj))
                        {
                            ExtendExport(htmlPage, obj, null);
                        }
                        else
                        {
                            LayerBack(htmlPage, obj, null);
                            LayerPicture(htmlPage, obj, null);
                        }
                    }
                }
            }
        }