123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124 |
- using System;
- using System.Windows.Forms;
- using Aspose.Cells.Rendering;
- using Aspose.Cells;
- using System.Drawing.Imaging;
- using UMESDLLService;
- namespace FileWatcher
- {
- public partial class Form5 : Form
- {
- public Form5()
- {
- InitializeComponent();
- }
- private void label12_Click(object sender, EventArgs e)
- {
- }
- private void textBox7_TextChanged(object sender, EventArgs e)
- {
- }
- private void textBox3_TextChanged(object sender, EventArgs e)
- {
- }
- public void ExportRangeAsJpg()
- {
- Workbook book = new Workbook(@"C:\\Users\\callm\\Desktop\\新建文件夹\\99001-91A1C2079.xls");
- for (int i = 0; i < book.Worksheets.Count; i++)
- {
- Worksheet sheet = book.Worksheets[i];
- Console.WriteLine(sheet.CodeName);
- Console.WriteLine(sheet.Name);
- sheet.PageSetup.LeftMargin = 0;
- sheet.PageSetup.RightMargin = 0;
- sheet.PageSetup.BottomMargin = 0;
- sheet.PageSetup.TopMargin = 0;
- ImageOrPrintOptions imgOptions = new ImageOrPrintOptions();
- imgOptions.ImageFormat = ImageFormat.Png;
- imgOptions.OnePagePerSheet = true;
- imgOptions.PrintingPage = PrintingPageType.IgnoreBlank;
- SheetRender sr = new SheetRender((Aspose.Cells.Worksheet)sheet, imgOptions);
- sr.ToImage(0, sheet.Name + ".png");
- }
- }
- private void Form4_Load(object sender, EventArgs e)
- {
- MESHelper mes=new MESHelper();
- string str = "";
- string str1 = "";
- mes.GetMobileAllInfo("58875734C2000134", out str, out str1);
- Console.WriteLine( str);
- }
- //private void SaveFileToJPG(Worksheet sheet)
- //{
- // try
- // {
- // //DataHelper dh = new DataHelper();
- // OperatResult.AppendText("解析图片【" + sheet.Name + ".jpg】添加水印" + "\n");
-
- // ExcelPicture picture = sheet.Pictures.Add(@"图片\电子受控章.png");
- // picture.Width = 113;
- // picture.Height = 38;
- // picture.LeftColumn = 20;
- // picture.TopRowOffset = 20;
- // ExcelPicture picture1 = sheet.Pictures.Add(@"图片\签名.png");
- // picture1.Width = 100;
- // picture1.Height = 38;
- // picture1.LeftColumn = 15;
- // picture1.TopRowOffset = 600;
- // sheet.SaveToImage(@"C:\Users\callm\Desktop\" + "新建文件夹"+ @"\" + sheet.Name + ".jpg");
- // OperatResult.AppendText("解析图片【" + sheet.Name + ".jpg】" + "\n");
- // Dictionary<string, object> dic = new Dictionary<string, object>();
- // dic.Add("em_name", "管理员");
- // dic.Add("em_code", "ADMIN");
- // dic.Add("caller", "ProductSOP");
- // OperatResult.AppendText("上传文件【" + sheet.Name + ".jpg" + "】\n");
- // }
- // catch (Exception ex)
- // {
- // OperatResult.AppendText(ex.Message + ex.StackTrace);
- // }
- //}
- //private void SaveFileToPDF(Worksheet sheet)
- //{
- // //if (!Directory.Exists(Application.StartupPath + @"\" + pr_code.Text))
- // //{
- // // Directory.CreateDirectory(Application.StartupPath + @"\" + pr_code.Text);
- // //}
- // sheet.SaveToPdf(@"C:\Users\callm\Desktop\" + "新建文件夹" + @"\" + sheet.Name + ".pdf");
- // OperatResult.AppendText("解析PDF【" + sheet.Name + ".pdf】" + "\n");
- // Dictionary<string, object> dic = new Dictionary<string, object>();
- // dic.Add("em_name", "管理员");
- // dic.Add("em_code", "ADMIN");
- // dic.Add("caller", "ProductSOP");
- // OperatResult.AppendText("上传文件【" + sheet.Name + ".pdf" + "】\n");
- //}
- private void ExcelDocViewer(string fileName)
- {
- try
- {
- System.Diagnostics.Process.Start(fileName);
- }
- catch { }
- }
- private void textBox4_TextChanged(object sender, EventArgs e)
- {
- }
- }
- }
|