Aspose.Cells将Excel转成pdf

Aspose.Cells Excel转成pdf

/// <summary>
        /// excel转pdf
        /// </summary>
        /// <param name="path">文件地址</param>
        /// <param name="newFilePath">转换后的文件地址</param>
        /// <returns></returns>
        public static void ExcelToPdf(string path, string newFilePath)
        {
            var dir = newFilePath.Substring(0, newFilePath.LastIndexOf("/") + 1);
            if (!Directory.Exists(dir))
            {
                Directory.CreateDirectory(dir);
            }
            Aspose.Cells.Workbook excel = new Aspose.Cells.Workbook(path);
            excel.Save(newFilePath, Aspose.Cells.SaveFormat.Pdf);
        }

猜你喜欢

转载自www.cnblogs.com/jiangqw/p/12124057.html