您好,欢迎光临本网站![请登录][注册会员]  
文件名称: PPT转图片程序
  所属分类: C#
  开发工具:
  文件大小: 161kb
  下载次数: 0
  上传时间: 2018-09-25
  提 供 者: gdoub*****
 详细说明: namespace PPT2Img { class Program { [STAThread] static void Main(string[] args) { TaskTimerRecorder taskTimerRecorder = new TaskTimerRecorder(); //确认需要执行的操作 //getinfo:获取总页数 //convert:将指定起始页码转换到指定文件夹 string strActionMode = "getinfo"; //拿到输入文件名 string strPPTFileName = "PPT路径"; //拿到输出图片路径 string strOutputFilePath = "图片输出路径"; //拿到输出图片的名词前缀(后缀就是从0计数的页码) string strPrefix = "输出图片前缀"; //需要抠掉的颜色 uint nColor = 0xffffffff; //需要输出的起始页码 int nBeginPage = 0; //需要输出的结束页码(-1为全部输出) int nEndPage = -1; //宽高 int nWidth = 1920; int nHeight = 1080; if (args.Length > 0) { strActionMode = args[0]; if (args.Length > 1) { strPPTFileName = args[1]; } if (args.Length > 2) { strOutputFilePath = args[2]; if (strActionMode == "getinfo") { Console.WriteLine("工作模式是:" + strActionMode); Console.WriteLine("PPT路径是:" + strPPTFileName); Console.WriteLine("结果输出路径是:" + strOutputFilePath); Console.WriteLine("开始执行"); ESBasic.Office.OfficeScanner scaner = new ESBasic.Office.OfficeScanner(); int nPage = scaner.GetInfo(strPPTFileName); FileStream fs = File.Create(strOutputFilePath + "pagecount.txt"); StreamWriter sw = new StreamWriter(fs); sw.WriteLine(nPage.ToString()); sw.Close(); fs.Close(); Console.WriteLine("执行结束"); return; } else if (strActionMode == "convert") { if (args.Length > 3) { strPrefix = args[3]; if (args.Length > 4) { string strColor = args[4]; nColor = uint.Parse(strColor, System.Globalization.NumberStyles.HexNumber); if (args.Length > 5) { string strBeginPage = args[5]; nBeginPage = int.Parse(strBeginPage); if (args.Length > 6) { string strEndPage = args[6]; nEndPage = int.Parse(strEndPage); if (args.Length > 7) { string strWidth = args[7]; nWidth = int.Parse(strWidth); if (args.Length > 8) { string strHeight = args[8]; nHeight = int.Parse(strHeight); //Console.WriteLine("1:工作模式是:" + strActionMode); //Console.WriteLine("2:PPT路径是:" + strPPTFileName); //Console.WriteLine("3:图片输出路径是:" + strOutputFilePath); //Console.WriteLine("4:图片输出前缀是:" + strPrefix); //Console.WriteLine("5:需要抠掉的颜色是:" + nColor.ToString()); //Console.WriteLine("6:输出起始页码是:" + nBeginPage.ToString()); //Console.WriteLine("7:输出结束页码是:" + nEndPage.ToString()); //Console.WriteLine("8:输出宽度是" + nWidth.ToString()); //Console.WriteLine("9:输出高度是" + nHeight.ToString()); //Console.WriteLine("1:" + strActionMode); //Console.WriteLine("2:" + strPPTFileName); //Console.WriteLine("3:" + strOutputFilePath); //Console.WriteLine("4:" + strPrefix); //Console.WriteLine("5:" + nColor.ToString()); //Console.WriteLine("6:" + nBeginPage.ToString()); //Console.WriteLine("7:" + nEndPage.ToString()); //Console.WriteLine("8:" + nWidth.ToString()); //Console.WriteLine("9:" + nHeight.ToString()); ESBasic.Office.OfficeScanner scaner = new ESBasic.Office.OfficeScanner(); int nPage = scaner.Convert(strPPTFileName, strOutputFilePath, strPrefix, nColor, nBeginPage, nEndPage, nWidth, nHeight); FileStream fs = File.Create(strOutputFilePath + "pagecount.txt"); StreamWriter sw = new StreamWriter(fs); sw.WriteLine(nPage.ToString()); sw.Close(); fs.Close(); return; } } } } } } Console.WriteLine("1:" + strActionMode); Console.WriteLine("2:" + strPPTFileName); Console.WriteLine("3:" + strOutputFilePath); Console.WriteLine("4:" + strPrefix); Console.WriteLine("5:" + nColor.ToString()); Console.WriteLine("6:" + nBeginPage.ToString()); Console.WriteLine("7:" + nEndPage.ToString()); Console.WriteLine("8:" + nEndPage.ToString()); Console.WriteLine("9:" + nEndPage.ToString()); Console.WriteLine("10"); } } } else { #if false //无参数模式,给一些参数,调试使用 strActionMode = "convert"; strPPTFileName = "C:\\Users\\dujiangtao\\Desktop\\测试2.pptx"; strOutputFilePath = "E:\\output\\"; strPrefix = "ppt"; nColor = 0x000000ff; nWidth = 1920; nHeight = 1080; nColor = uint.Parse("000000ff", System.Globalization.NumberStyles.HexNumber); nBeginPage = 0; nEndPage = -1; ESBasic.Office.OfficeScanner scaner = new ESBasic.Office.OfficeScanner(); int nPage = scaner.Convert(strPPTFileName, strOutputFilePath, strPrefix, nColor, nBeginPage, nEndPage, nWidth, nHeight); FileStream fs = File.Create(strOutputFilePath + "pagecount.txt"); StreamWriter sw = new StreamWriter(fs); sw.WriteLine(nPage.ToString()); sw.Close(); fs.Close(); taskTimerRecorder.Stop(); Console.ReadLine(); #endif } } } } ...展开详情收缩
(系统自动生成,下载前可以参看下载内容)

下载文件列表

相关说明

  • 本站资源为会员上传分享交流与学习,如有侵犯您的权益,请联系我们删除.
  • 本站是交换下载平台,提供交流渠道,下载内容来自于网络,除下载问题外,其它问题请自行百度
  • 本站已设置防盗链,请勿用迅雷、QQ旋风等多线程下载软件下载资源,下载后用WinRAR最新版进行解压.
  • 如果您发现内容无法下载,请稍后再次尝试;或者到消费记录里找到下载记录反馈给我们.
  • 下载后发现下载的内容跟说明不相乎,请到消费记录里找到下载记录反馈给我们,经确认后退回积分.
  • 如下载前有疑问,可以通过点击"提供者"的名字,查看对方的联系方式,联系对方咨询.
 相关搜索: PPT
 输入关键字,在本站1000多万海量源码库中尽情搜索: