예제 #1
0
        private void CompareSameRange(PPTmpPage comparedPage, int rows, int cols)
        {
            string cellValue = null;
            string str2      = null;

            for (int i = 1; i <= rows; i++)
            {
                for (int j = 1; j <= cols; j++)
                {
                    cellValue = this.GetCellValue(i, j);
                    str2      = comparedPage.GetCellValue(i, j);
                    if (cellValue != str2)
                    {
                        if (((cellValue == "") && (str2 != "")) || ((cellValue != "") && (str2 == "")))
                        {
                            this.SetFontColor(this.GetRange(i, j), "Red");
                            comparedPage.SetFontColor(comparedPage.GetRange(i, j), "Red");
                        }
                        else
                        {
                            this.SetFontColor(this.GetRange(i, j), "Blue");
                            comparedPage.SetFontColor(comparedPage.GetRange(i, j), "Blue");
                        }
                    }
                }
            }
        }
예제 #2
0
        private PPTmpPage GetTmpPage(string tabText)
        {
            PPTmpPage page = null;
            string    str  = tabText;

            if (str == null)
            {
                return(page);
            }
            if (str != "封面")
            {
                if (str != "首页")
                {
                    if (str != "续页")
                    {
                        return(page);
                    }
                    return(this.pageNextPage);
                }
            }
            else
            {
                return(this.pageCover);
            }
            return(this.pageMainPage);
        }
예제 #3
0
        private void OnImport(object sender, EventArgs e)
        {
            int    num = Convert.ToInt32(PPMCommon.GetRegistryKey());
            string str = "HTML文件 (*.htm;*.html)|*.htm;*.html|所有文件 (*.*)|*.*";

            if (num < 12)
            {
                str = "Excel工作簿 (*.xls)|*.xls|" + str;
            }
            else
            {
                str = "Excel工作簿 (*.xlsx)|*.xlsx|Excel 97-2003 工作簿 (*.xls)|*.xls|" + str;
            }
            OpenFileDialog dialog = new OpenFileDialog {
                Title  = "请您选择文件",
                Filter = str
            };

            if (dialog.ShowDialog() == DialogResult.OK)
            {
                string str2 = Path.GetExtension(dialog.FileName).ToLower();
                if (((num >= 12) && ((str2 == ".xls") || (str2 == ".xlsx"))) || ((num < 12) && (str2 == ".xls")))
                {
                    ArrayList list;
                    Cursor    current = Cursor.Current;
                    Cursor.Current = Cursors.WaitCursor;
                    try {
                        if (OfficeWrap.Instance == null)
                        {
                            OfficeWrap.Instance = new OfficeWrap();
                        }
                        list = OfficeWrap.Instance.Import(dialog.FileName, BizOperationHelper.Instance.GetTempFilePath());
                    } catch (Exception exception) {
                        MessageBox.Show(exception.Message, "PPM - FrmPPCard", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                        return;
                    } finally {
                        Cursor.Current = current;
                    }
                    PPTmpPage tmpPage = this.GetTmpPage(base.SelectedTab.Text);
                    if (list.Count > 0)
                    {
                        tmpPage.TemplateUrl = (string)list[0];
                        this.m_tp.IsSaved   = false;
                    }
                }
                else
                {
                    this.GetTmpPage(base.SelectedTab.Text).TemplateUrl = dialog.FileName;
                    this.m_tp.IsSaved = false;
                }
            }
        }
예제 #4
0
        public void PageCompare(PPTmpPage comparedPage)
        {
            this.SetDefaultColor(comparedPage);
            int countRows    = this.countRows;
            int rowEnd       = comparedPage.countRows;
            int countColumns = this.countColumns;
            int col          = comparedPage.countColumns;

            if ((countRows == rowEnd) && (countColumns == col))
            {
                this.CompareSameRange(comparedPage, countRows, countColumns);
            }
            else if (countRows < rowEnd)
            {
                comparedPage.SetRowColor(countRows, rowEnd, col);
                if (countColumns == col)
                {
                    this.CompareSameRange(comparedPage, countRows, countColumns);
                }
                else if (countColumns > col)
                {
                    this.CompareSameRange(comparedPage, countRows, col);
                    this.SetColColor(col + 1, countColumns, countRows);
                }
                else
                {
                    this.CompareSameRange(comparedPage, countRows, countColumns);
                    comparedPage.SetColColor(countColumns + 1, col, countRows);
                }
            }
            else
            {
                this.SetRowColor(rowEnd + 1, countRows, countColumns);
                if (countColumns == col)
                {
                    this.CompareSameRange(comparedPage, rowEnd, countColumns);
                }
                else if (countColumns > col)
                {
                    this.CompareSameRange(comparedPage, rowEnd, col);
                    this.SetColColor(col + 1, countColumns, rowEnd);
                }
                else
                {
                    this.CompareSameRange(comparedPage, rowEnd, countColumns);
                    comparedPage.SetColColor(countColumns + 1, col, rowEnd);
                }
            }
        }
예제 #5
0
        private void PrintPreview()
        {
            PPTmpPage tmpPage = this.GetTmpPage(base.SelectedTab.Text);

            Convert.ToInt32(PPMCommon.GetRegistryKey());
            string exportFileName = BizOperationHelper.Instance.GetTempFilePath() + base.SelectedTab.Text + ".xls";

            tmpPage.Export(exportFileName, false);
            if (OfficeWrap.Instance == null)
            {
                OfficeWrap.Instance = new OfficeWrap();
            }
            OfficeWrap.Instance.SetupPages(this.m_tp.PageSetup);
            OfficeWrap.Instance.PrintPreview(exportFileName);
        }
예제 #6
0
 private void InitializePages()
 {
     if (this.m_tp.HasCover)
     {
         TabPage page = new TabPage("封面");
         if (File.Exists(this.m_tp.CoverPath))
         {
             this.pageCover = new PPTmpPage(this.m_tp, this.m_tp.CoverPath, this.m_tp.RowCountOfCover, this.m_tp.ColCountOfCover, this.m_tp.MidBeginOfCover, this.m_tp.MidEndOfCover, this.m_tp.ReadOnly);
         }
         else
         {
             this.pageCover = new PPTmpPage(this.m_tp, this.m_tp.RowCountOfCover, this.m_tp.ColCountOfCover, this.m_tp.MidBeginOfCover, this.m_tp.MidEndOfCover, this.m_tp.ReadOnly, this.m_tp.CoverText);
         }
         page.Controls.Add(this.pageCover);
         base.TabPages.Add(page);
     }
     if (this.m_tp.HasMainPage)
     {
         TabPage page2 = new TabPage("首页");
         if (File.Exists(this.m_tp.MainPagePath))
         {
             this.pageMainPage = new PPTmpPage(this.m_tp, this.m_tp.MainPagePath, this.m_tp.RowCountOfMain, this.m_tp.ColCountOfMain, this.m_tp.MidBeginOfMain, this.m_tp.MidEndOfMain, this.m_tp.ReadOnly);
         }
         else
         {
             this.pageMainPage = new PPTmpPage(this.m_tp, this.m_tp.RowCountOfMain, this.m_tp.ColCountOfMain, this.m_tp.MidBeginOfMain, this.m_tp.MidEndOfMain, this.m_tp.ReadOnly, this.m_tp.MainPageText);
         }
         page2.Controls.Add(this.pageMainPage);
         base.TabPages.Add(page2);
     }
     if (this.m_tp.HasNextPage)
     {
         TabPage page3 = new TabPage("续页");
         if (File.Exists(this.m_tp.NextPagePath))
         {
             this.pageNextPage = new PPTmpPage(this.m_tp, this.m_tp.NextPagePath, this.m_tp.RowCountOfNext, this.m_tp.ColCountOfNext, this.m_tp.MidBeginOfNext, this.m_tp.MidEndOfNext, this.m_tp.ReadOnly);
         }
         else
         {
             this.pageNextPage = new PPTmpPage(this.m_tp, this.m_tp.RowCountOfNext, this.m_tp.ColCountOfNext, this.m_tp.MidBeginOfNext, this.m_tp.MidEndOfNext, this.m_tp.ReadOnly, this.m_tp.NextPageText);
         }
         page3.Controls.Add(this.pageNextPage);
         base.TabPages.Add(page3);
     }
 }
예제 #7
0
 private void SetDefaultColor(PPTmpPage comparedPage)
 {
     this.SetFontColor(this.GetRange("A1", PPCConvert.RowCol2Address(this.countRows, this.countColumns)), "Black");
     comparedPage.SetFontColor(comparedPage.GetRange("A1", PPCConvert.RowCol2Address(comparedPage.countRows, comparedPage.countColumns)), "Black");
 }