Example #1
0
        private void ShwBtn_Click(object sender, EventArgs e)
        {
            IISmpGenericReport m_ISmpGenericReport;

            m_ISmpGenericReport = new ISmpGenericReportClass();
            string strBContent = "", strBContentName = "", strCRow = "", strCCol = "", strCMRow = "", strCMCol = "", strCAligment = "";

            GetAttributeValues();
            try
            {
                m_ISmpGenericReport.AddReportHeading(Convert.ToInt32(strHRow), Convert.ToInt32(strHCol), Convert.ToInt32(strHMRow), Convert.ToInt32(strHMCol), Header, Convert.ToInt32(StringAlignment.Center), 0);
                for (int i = 0; i < RsltList.Items.Count; i++)
                {
                    RsltList.Items[i].Selected = true;
                    if (RsltList.Items[i].Selected == true)
                    {
                        strBContentName = RsltList.Items[i].SubItems[0].Text;
                        strBContent     = RsltList.Items[i].SubItems[1].Text;
                        strCRow         = RsltList.Items[i].SubItems[2].Text;
                        strCCol         = RsltList.Items[i].SubItems[3].Text;
                        strCMRow        = RsltList.Items[i].SubItems[4].Text;
                        strCMCol        = RsltList.Items[i].SubItems[5].Text;
                        strCAligment    = RsltList.Items[i].SubItems[6].Text;
                    }

                    m_ISmpGenericReport.AddBodyContentsEx(Convert.ToInt32(strCRow), Convert.ToInt32(strCCol), strBContentName, Right, 1);
                    m_ISmpGenericReport.AddBodyContentsEx(Convert.ToInt32(strCRow), Convert.ToInt32(strCCol) + 1, strBContent, Right, 1);
                }
                m_ISmpGenericReport.AddFooterContents(Convert.ToInt32(strFRow), Convert.ToInt32(strFCol), Convert.ToInt32(strFMRow), Convert.ToInt32(strFMCol), Footer, Convert.ToInt32(StringAlignment.Center), 0);
                m_ISmpGenericReport.FillReport();
            }
            catch (Exception EX)
            {
                MessageBox.Show(EX.ToString());
            }
        }
        private void ShwBtn_Click(object sender, EventArgs e)
        {
            GetAttributes();

            string strHeaderFont = "Monotype Corsiva";
            string strFooterFont = "Verdana";
            string strContentName, strContent, strCRow, strCMRow, strCCol, strCMCol, strCAligment;

            IISmpGenericReport m_ISmpGenericReport;

            m_ISmpGenericReport = new ISmpGenericReportClass();

            ISmpReportItemAttributes m_SmpReportItemAttributes_Body;

            m_SmpReportItemAttributes_Body = new SmpReportItemAttributesClass();

            ISmpReportItemAttributes m_SmpReportItemAttributes_Header;

            m_SmpReportItemAttributes_Header = new SmpReportItemAttributesClass();

            ISmpReportItemAttributes m_SmpReportItemAttributes_Footer;

            m_SmpReportItemAttributes_Footer = new SmpReportItemAttributesClass();

            IItem m_Item_Header;

            m_Item_Header = new ItemClass();

            Item m_ItemHeader;

            m_ItemHeader = new Item();

            Item m_ItemFooter;

            m_ItemFooter = new Item();

            IItem m_Item_Footer;

            m_Item_Footer = new ItemClass();

            try
            {
                m_Item_Header.Content     = strHeader;
                m_Item_Header.ContentType = 0;
                m_Item_Header.Col         = Convert.ToInt32(strHCol);
                m_Item_Header.HAlign      = Convert.ToInt32(StringAlignment.Center);
                m_Item_Header.MaxCol      = Convert.ToInt32(strHMCol);
                m_Item_Header.MaxRow      = Convert.ToInt32(strHMRow);
                m_Item_Header.Row         = Convert.ToInt32(strHRow);

                m_Item_Footer.Col         = Convert.ToInt32(strFCol);
                m_Item_Footer.Content     = strFooter;
                m_Item_Footer.ContentType = 0;
                m_Item_Footer.HAlign      = Convert.ToInt32(StringAlignment.Center);
                m_Item_Footer.MaxCol      = Convert.ToInt32(strFMCol);
                m_Item_Footer.MaxRow      = Convert.ToInt32(strFMRow);
                m_Item_Footer.Row         = Convert.ToInt32(strFRow);

                //Header Properties

                if (strHFontColor == "RED")
                {
                    m_SmpReportItemAttributes_Header.ForgroundColor = Convert.ToUInt32(ColorTranslator.ToOle(Color.FromArgb(255, 0, 0)));
                }
                else if (strHFontColor == "BLUE")
                {
                    m_SmpReportItemAttributes_Header.ForgroundColor = Convert.ToUInt32(ColorTranslator.ToOle(Color.FromArgb(0, 0, 255)));
                }
                else
                {
                    m_SmpReportItemAttributes_Header.ForgroundColor = Convert.ToUInt32(ColorTranslator.ToOle(Color.FromArgb(0, 255, 0)));
                }
                if (HBoldCheckBox.Checked == true)
                {
                    m_SmpReportItemAttributes_Header.HeadingBold = 1;
                }
                m_SmpReportItemAttributes_Header.HeadingFont     = strHeaderFont;
                m_SmpReportItemAttributes_Header.HeadingFontSize = Convert.ToInt32(strHFontSize);
                m_SmpReportItemAttributes_Header.ItemCount       = 5;
                m_SmpReportItemAttributes_Header.set_Item(0, m_ItemHeader);

                //Body Properties
                if (CBoldCheckBox.Checked == true)
                {
                    m_SmpReportItemAttributes_Body.NormalBold = 1;
                }
                m_SmpReportItemAttributes_Body.NormalFontSize = 20;
                if (CItalicsCombo.Checked == true)
                {
                    m_SmpReportItemAttributes_Body.NormalItalic = 1;
                }
                if (CShowheadingCheckBox.Checked == true)
                {
                    m_SmpReportItemAttributes_Body.ShowHeading = 1;
                }

                //Footer Properties
                if (strFFontColor == "RED")
                {
                    m_SmpReportItemAttributes_Footer.ForgroundColor = Convert.ToUInt32(ColorTranslator.ToOle(Color.FromArgb(255, 0, 0)));
                }
                else if (strFFontColor == "BLUE")
                {
                    m_SmpReportItemAttributes_Footer.ForgroundColor = Convert.ToUInt32(ColorTranslator.ToOle(Color.FromArgb(0, 0, 255)));
                }
                else
                {
                    m_SmpReportItemAttributes_Footer.ForgroundColor = Convert.ToUInt32(ColorTranslator.ToOle(Color.FromArgb(0, 255, 0)));
                }
                if (FBoldCheckBox.Checked == true)
                {
                    m_SmpReportItemAttributes_Footer.FooterBold = 1;
                }
                m_SmpReportItemAttributes_Footer.FooterFont     = strFooterFont;
                m_SmpReportItemAttributes_Footer.FooterFontSize = Convert.ToInt32(strFFontSize);
                m_SmpReportItemAttributes_Footer.ItemCount      = 5;
                m_SmpReportItemAttributes_Footer.set_Item(0, m_ItemFooter);

                m_ISmpGenericReport.HeaderProperties = (SmpReportItemAttributes)m_SmpReportItemAttributes_Header;
                m_ISmpGenericReport.BodyProperties   = (SmpReportItemAttributes)m_SmpReportItemAttributes_Body;
                m_ISmpGenericReport.FooterProperties = (SmpReportItemAttributes)m_SmpReportItemAttributes_Footer;

                m_ISmpGenericReport.AddReportHeading(m_Item_Header.Row, m_Item_Header.Col, m_Item_Header.MaxRow, m_Item_Header.MaxCol, m_Item_Header.Content, m_Item_Header.HAlign, m_Item_Header.ContentType);

                for (int icount = 0; icount < RsltList.Items.Count; icount++)
                {
                    RsltList.Items[icount].Selected = true;
                    if (RsltList.Items[icount].Selected == true)
                    {
                        strContentName = RsltList.Items[icount].SubItems[0].Text;
                        strContent     = RsltList.Items[icount].SubItems[1].Text;
                        strCRow        = RsltList.Items[icount].SubItems[2].Text;
                        strCCol        = RsltList.Items[icount].SubItems[3].Text;
                        strCMRow       = RsltList.Items[icount].SubItems[4].Text;
                        strCMCol       = RsltList.Items[icount].SubItems[5].Text;
                        strCAligment   = RsltList.Items[icount].SubItems[6].Text;

                        m_ISmpGenericReport.AddBodyContentsEx(Convert.ToInt32(strCRow), Convert.ToInt32(strCCol), strContentName, Right, 1);
                        m_ISmpGenericReport.AddBodyContentsEx(Convert.ToInt32(strCRow), Convert.ToInt32(strCCol) + 1, strContent, Right, 1);
                    }
                }

                m_ISmpGenericReport.AddFooterContents(m_Item_Footer.Row, m_Item_Footer.Col, m_Item_Footer.MaxRow, m_Item_Footer.MaxCol, m_Item_Footer.Content, m_Item_Footer.HAlign, m_Item_Footer.ContentType);

                m_ISmpGenericReport.FillReport();
            }
            catch (Exception EX)
            {
                MessageBox.Show(EX.ToString());
            }
        }