当前位置: 首页>>代码示例>>C#>>正文


C# Worksheet.ExportAsFixedFormat方法代码示例

本文整理汇总了C#中Worksheet.ExportAsFixedFormat方法的典型用法代码示例。如果您正苦于以下问题:C# Worksheet.ExportAsFixedFormat方法的具体用法?C# Worksheet.ExportAsFixedFormat怎么用?C# Worksheet.ExportAsFixedFormat使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Worksheet的用法示例。


在下文中一共展示了Worksheet.ExportAsFixedFormat方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: SaveBillAsPDF

        public void SaveBillAsPDF(Worksheet worksheet)
        {
            string directory = string.Format("{0}\\{1}", billsDirectory, clientName);
            string fullName = string.Format("{0}\\{1}{2}", directory, billName, ".pdf");

            fileManager.CreateDirectoryIfDoesNotExist(directory);
            fileManager.CreateFileIfDoesNotExist(fullName);

            worksheet.ExportAsFixedFormat(XlFixedFormatType.xlTypePDF, fullName);
        }
开发者ID:Babelz,项目名称:EzBilling,代码行数:10,代码来源:BillWriter.cs

示例2: Main


//.........这里部分代码省略.........
                        //string newfilePath = filePaths[i].DocumentPath.Replace("D:\\", "E:\\");
                        string newfilePath = filePaths[i].DocumentPath.Replace("D:\\", "\\\\192.168.190.161\\");
                       // newfilePath = newfilePath.Replace("\\\\", "\\");
                        theFileName = GetFileName(newfilePath);
                        LogWithoutPath("file path: D: " + theFileName);
                        LogWithoutPath("end get file name");
                        LogWithoutPath("start open work book");
                        //wkb = app.Workbooks.Open(copyExcellTo + theFileName + ".xls");
                        try
                        {

                            //wkb = app.Workbooks.Open(filePaths[i].DocumentPath);
                            wkb = app.Workbooks.Open(newfilePath);

                            LogWithoutPath("end open work book");
                            //Workbook wkb = app.Workbooks.Open("C:\\temp3\\2004107065.xls");
                            //\\hmdn-srseds\SRSServer\Storage\16\1627369463\2004108635

                            //Workbook wkb = app.Workbooks.Open(filePaths[i].DocumentPath);
                            LogWithoutPath("start get work sheet");
                            sheet = (Worksheet)wkb.Worksheets[1];
                            LogWithoutPath("end get work sheet");
                            //sheet.PageSetup.FitToPagesWide = 1;
                            sheet.Select(Type.Missing);
                            //wkb.set.ActiveSheet = sheet;
                            LogWithoutPath("start save to pdf");
                        }
                        catch (Exception er)
                        { 
                        string s1 = er.ToString();
                        }
                        try
                        {
                            sheet.ExportAsFixedFormat(XlFixedFormatType.xlTypePDF, savePDFTo + theFileName + ".pdf", XlFixedFormatQuality.xlQualityStandard, false, false, 1, 1, true);
                        }
                        catch
                        { }

                        LogWithoutPath("end save to pdf");
                        Console.WriteLine("finished with number: " + i.ToString());
                        LogWithoutPath("start close resources");

                        try
                        {
                            wkb.Close(false);
                            app.Application.Quit();
                            app.Quit();

                        }
                        catch { }

                        try
                        {
                            Marshal.ReleaseComObject(sheet);
                            Marshal.ReleaseComObject(wkb);
                            Marshal.ReleaseComObject(app);
                            Marshal.ReleaseComObject(wkb);
                            Marshal.ReleaseComObject(app);
                        }
                        catch { }

                        try
                        {
                            Process[] excelProcess = Process.GetProcessesByName("Excel");
                            excelProcess[0].Kill();
                        }
开发者ID:connecticutortho,项目名称:ct-ortho-repositories4,代码行数:67,代码来源:Program.cs

示例3: Excel2pdfProc

        protected virtual int Excel2pdfProc(Worksheet sheet, int idx, int file_c)
        {
            if (this.Fails.Count > 0)
            {
                return 0;
            }
            var pdf = Path.GetTempFileName() + ".pdf";
            try
            {
                if (this.ShowLog)
                {
                    L.D("excel2pdf parsing file({0},{1}) to {1}", this.AsSrc, idx, pdf);
                }
                sheet.ExportAsFixedFormat(XlFixedFormatType.xlTypePDF, pdf);
                var images = new MagickImageCollection();
                this.Images.Add(images);
                var added = this.Pdf2imgProc(images, pdf, idx, file_c);
                return added;
            }
            catch (Exception e)
            {
                this.Result.Code = 500;
                this.Fails.Add(e);
                return 0;
            }
            finally
            {
                try
                {
                    File.Delete(pdf);
                }
                catch (Exception)
                {

                }
            }
        }
开发者ID:Centny,项目名称:cswf.doc,代码行数:37,代码来源:ExcelCov.cs


注:本文中的Worksheet.ExportAsFixedFormat方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。