Exemplo n.º 1
0
        /// <summary>
        /// 打印Excel文档
        /// </summary>
        /// <param name="excel"></param>
        public void PrintOut(ClsExcel excel)
        {
            int iCounter = excel.WorkSheetCount();

            for (int i = 1; i <= iCounter; i++)
            {
                excel.SetActiveSheet(i);
                excel.PrintOut();
            }

            excel.Close(false);
        }
Exemplo n.º 2
0
        /// <summary>
        /// 打印Excel文档
        /// </summary>
        /// <param name="excel"></param>
        /// <param name="isLandcape">是否横向打印 true 为是</param>
        public void PrintOut(ClsExcel excel, bool isLandcape)
        {
            int iCounter = excel.WorkSheetCount();

            for (int i = 1; i <= iCounter; i++)
            {
                excel.SetActiveSheet(i);

                if (true == isLandcape)
                {
                    xSheet.PageSetup.Orientation = Excel.XlPageOrientation.xlLandscape;
                }

                excel.PrintOut();
            }

            excel.Close(false);
        }