예제 #1
0
        /***************************************************************************
         * Plot area properties
         **************************************************************************/
        private SGPlotArea GetXLPlotArea(Chart chart)
        {
            SGPlotArea pa   = new SGPlotArea();
            SGGeometry geom = new SGGeometry(chart.PlotArea.Left,
                                             chart.PlotArea.Top,
                                             chart.PlotArea.InsideHeight,
                                             chart.PlotArea.InsideWidth);

            pa.Geometry = geom;
            log.Debug("Plot area found, properties are " + geom.showAsString() + ".");

            return(pa);
        }
예제 #2
0
        /***************************************************************************
         * Text boxes are dealt with here
         **************************************************************************/
        private SGTextBoxCollection GetXLTextBoxes(Chart chart)
        {
            SGTextBoxCollection sg_textbox_collection = new SGTextBoxCollection();
            IEnumerator         text_box_enumerator   = ((TextBoxes)chart.TextBoxes
                                                             (Type.Missing)).GetEnumerator();
            int ctr = 0;

            if (chart.HasTitle)
            {
                ChartTitle ct    = chart.ChartTitle;
                SGTextBox  tibox = new SGTextBox();
                tibox.ID       = ctr;
                tibox.Geometry = new SGGeometry(0F, 0F, 0F, 0F);
                tibox.Text     = ct.Text;
                sg_textbox_collection.AddTextBox(tibox);
                ctr++;
            }

            while (text_box_enumerator.MoveNext())
            {
                SGTextBox sg_textbox = new SGTextBox();
                sg_textbox.ID = ctr;
                TextBox xl_textbox = (TextBox)text_box_enumerator.Current;

                // TextBox without text :)
                if (xl_textbox.Text.Length == 0)
                {
                    continue;
                }

                sg_textbox.Text    = xl_textbox.Text.Trim().Replace("\n", "");
                sg_textbox.BoxSize = new Size(xl_textbox.Width, xl_textbox.Height);
                SGGeometry txtbox_geom = new SGGeometry(xl_textbox.Left,
                                                        xl_textbox.Top, xl_textbox.Height, xl_textbox.Width);
                sg_textbox.Geometry = txtbox_geom;

                /**
                 * Excel constants for horizontal alignment are found at
                 * \latexonly
                 * \url{http://msdn.microsoft.com/en-us/library/aa221100(office.11).spx}
                 * \endlatexonly
                 */

                switch (xl_textbox.HorizontalAlignment.ToString())
                {
                case "-4131":
                    sg_textbox.Justification = SGTextBox.HorizontalAlignment.LEFT;
                    break;

                case "-4108":
                    sg_textbox.Justification = SGTextBox.HorizontalAlignment.CENTER;
                    break;

                case "-4152":
                    sg_textbox.Justification = SGTextBox.HorizontalAlignment.RIGHT;
                    break;

                case "-4130":
                    sg_textbox.Justification = SGTextBox.HorizontalAlignment.JUSTIFIED;
                    break;
                }
                sg_textbox_collection.AddTextBox(sg_textbox);
                log.Debug(sg_textbox.ReturnAsString());
                ctr++;
            }
            log.Debug(ctr + " legal text box(es) found.");
            return(sg_textbox_collection);
        }