예제 #1
0
        private bool Printcells(string filepath, string printerName)
        {
            int b = Cell2.OpenFile(filepath, "");

            if (b != 1)
            {
                return(false);
            }

            Cell2.PrintSetAlign(1, 1);
            Cell2.PrintSetMargin(5, 5, 5, 5);

            //判断当前页 所有的单元是否只读
            // 如果当前页的所有单元格只读,就不转换PDF
            // 否则 就直接转换PDF
            bool isToPDF_flg = true;

            for (int j = 0; j < Cell2.GetTotalSheets(); j++)
            {
                Cell2.SetCurSheet(j);
                string TittleName = Cell2.GetSheetLabel(j);
                if (TittleName != null &&
                    TittleName.Contains("填表提示"))//
                {
                    continue;
                }

                isToPDF_flg = true;
                for (int iRow = 1; iRow < Cell2.GetRows(j) - 1; iRow++)
                {
                    if (!isToPDF_flg)
                    {
                        break;
                    }
                    if (Cell2.IsRowHidden(iRow, j) == false && Cell2.GetRowHeight(1, iRow, j) > 10)
                    {
                        for (int iCol = 1; iCol < Cell2.GetCols(j) - 1; iCol++)
                        {
                            if (!isToPDF_flg)
                            {
                                break;
                            }
                            if (Cell2.IsColHidden(iCol, j) == false && Cell2.GetColWidth(1, iCol, j) > 10)
                            {
                                if (Cell2.GetCellInput(iCol, iRow, j) != 5)
                                {
                                    isToPDF_flg = false;
                                    break;
                                }
                            }
                        }
                    }
                }
                if ((!isToPDF_flg))
                {
                    Cell2.PrintSheet(0, j);
                }
            }
            Cell2.closefile();
            return(true);
        }