当前位置: 首页 > news >正文

网站模块是指什么地方打开百度app

网站模块是指什么地方,打开百度app,石家庄语音网站建设公司,zend studio 网站开发以村庄规划制图为例,通过对现状和规划用地的统计,生成Excel格式的【空间功能结构调整表】后,需要进一步将表格导出成图片,并嵌入到图集中,这样可以实现全流程不用手动参与,让制图的流程完全自动化。 关于E…

以村庄规划制图为例,通过对现状和规划用地的统计,生成Excel格式的【空间功能结构调整表】后,需要进一步将表格导出成图片,并嵌入到图集中,这样可以实现全流程不用手动参与,让制图的流程完全自动化。

关于Excel截图的方法,从python、c#都曾经历过,虽然有些方法已经不再用,但还是记录下来。

Excel表格如下:

导出的图片如下:

基本是完美的截图。


1、Python的截图方法

python里处理Excel的库不少,我使用的是PyWin32。

其它的库可能也能实现这个功能,但我没找到。

直接上代码:

import win32com.client as win32
from PIL import ImageGrab
import osexcel = win32.Dispatch('Excel.Application')
wb = excel.Workbooks.Open(excel_file)
ws = wb.WorkSheets(excel_tb)  # 打开工作簿# 示例:截图的起始终止格
start_cell = "B2"
end_cell = "G8"ws.Range(f"{start_cell}:{end_cell}").CopyPicture()  # 变成图片
ws.Paste(ws.Range(start_cell))  # 将图片黏贴在excel中ws.Shapes(ws.Shapes.Count).Copy()  # 图片至剪贴板
img = ImageGrab.grabclipboard()  # 从剪贴板获取图片
img.save(output_png_path)  # 图片保存
wb.Save()  # excel保存
wb.Close()

这里的方法有曲折,相当于选定范围后,在Excel里CTRL+C,CTRL+V,然后再将粘贴后的图片复制出去。

2、C#的截图方法一:【Microsoft.Office.Interop.Excel】

【Microsoft.Office.Interop.Excel】库的功能非常强大,但它需要安装微软的Office才能使用,并且有兼容性和进程占用的问题,缺点也很明显。实际上这个方法之前也写过,这里复述一遍。

using Microsoft.Office.Interop.Excel;
using Application = Microsoft.Office.Interop.Excel.Application;
using Range = Microsoft.Office.Interop.Excel.Range;// Excel指定范围导出JPG图片
public static void ExcelImportToJPG(string excelPath, string startRange, string endRange, string outputPath)
{// 在UI线程上执行添加item的操作System.Windows.Application.Current.Dispatcher.Invoke(() =>{// 例如:A1:G6string rangeAddress = startRange + ":" + endRange;// 创建Excel应用程序对象Application excelApp = new Application();// 打开Excel文件Workbook workbook = excelApp.Workbooks.Open(excelPath);// 获取工作表Worksheet worksheet = workbook.Sheets[1];// 获取范围对象Microsoft.Office.Interop.Excel.Range range = worksheet.Range[rangeAddress];// 获取范围的像素宽度和高度int widthInPixels = (int)Math.Round(range.Width * 1.3333);int heightInPixels = (int)Math.Round(range.Height * 1.3333);// 创建位图对象Bitmap bitmap = new Bitmap(widthInPixels, heightInPixels);// 将范围内容复制到剪贴板range.CopyPicture(XlPictureAppearance.xlScreen, XlCopyPictureFormat.xlBitmap);// 获取剪贴板图像数据System.Drawing.Image clipboardImage = null;if (System.Windows.Forms.Clipboard.ContainsImage()){clipboardImage = System.Windows.Forms.Clipboard.GetImage();// 在位图上绘制剪贴板图像using (Graphics graphics = Graphics.FromImage(bitmap)){graphics.DrawImage(clipboardImage, 0, 0);}// 将位图保存为图片文件bitmap.Save(outputPath, ImageFormat.Jpeg); // 或者保存为PNG图片,将第二个参数改为ImageFormat.Png}// 关闭和释放资源workbook.Close(false);excelApp.Quit();System.Runtime.InteropServices.Marshal.ReleaseComObject(worksheet);System.Runtime.InteropServices.Marshal.ReleaseComObject(workbook);System.Runtime.InteropServices.Marshal.ReleaseComObject(excelApp);// 清空剪贴板数据System.Windows.Forms.Clipboard.Clear();});
}

3、C#的截图方法二:【Aspose.cells】

考虑到【Microsoft.Office.Interop.Excel】库的一些问题实在无法解决,后来选择了【Aspose.cells】库作为替代,那这个截图方法也得解决。

经网友【俊,】的帮助,【Aspose.cells】同样实现了这一方法,完美替代了【Microsoft.Office.Interop.Excel】。

代码如下:

using Aspose.Cells;
using Aspose.Cells.Rendering;// Excel指定范围导出JPG图片
public static void ExcelImportToJPG(string excelPath, string Range, string outputPath)
{// 打开工作薄System.Text.Encoding.RegisterProvider(System.Text.CodePagesEncodingProvider.Instance);LoadOptions loadOptinos = new LoadOptions(LoadFormat.Xlsx);Workbook wb = new Workbook(excelPath, loadOptinos);// 打开工作表Worksheet sheet = wb.Worksheets[0];// 定义要截图的单元格范围   例:Range = "B2:G26"Range range = sheet.Cells.CreateRange(Range);// 设置打印属性ImageOrPrintOptions imgOptions = new ImageOrPrintOptions();// 在一页内打印imgOptions.OnePagePerSheet = true;// 只打印区域内imgOptions.OnlyArea = true;// 打印SheetRender render = new SheetRender(sheet, imgOptions);render.ToImage(0, outputPath);// 保存wb.Save(excelPath);wb.Dispose();
}

文章转载自:
http://scorify.fcxt.cn
http://photochemical.fcxt.cn
http://lamda.fcxt.cn
http://neuroactive.fcxt.cn
http://compulsively.fcxt.cn
http://fixup.fcxt.cn
http://imprisonable.fcxt.cn
http://pauperization.fcxt.cn
http://scapular.fcxt.cn
http://lingerie.fcxt.cn
http://biomass.fcxt.cn
http://happening.fcxt.cn
http://haemagglutinate.fcxt.cn
http://pleuroperitoneal.fcxt.cn
http://hopvine.fcxt.cn
http://squeegee.fcxt.cn
http://listel.fcxt.cn
http://unauthentic.fcxt.cn
http://birdie.fcxt.cn
http://lifeline.fcxt.cn
http://germ.fcxt.cn
http://goatherd.fcxt.cn
http://hexagonal.fcxt.cn
http://decane.fcxt.cn
http://turtledove.fcxt.cn
http://synecious.fcxt.cn
http://forspent.fcxt.cn
http://glad.fcxt.cn
http://legit.fcxt.cn
http://lcp.fcxt.cn
http://zamindar.fcxt.cn
http://nauch.fcxt.cn
http://longanimity.fcxt.cn
http://intrazonal.fcxt.cn
http://trias.fcxt.cn
http://pollyanna.fcxt.cn
http://cellulosic.fcxt.cn
http://udt.fcxt.cn
http://phyllary.fcxt.cn
http://ipy.fcxt.cn
http://spongiopilin.fcxt.cn
http://tribromoethanol.fcxt.cn
http://diminutive.fcxt.cn
http://nrem.fcxt.cn
http://slavism.fcxt.cn
http://amphictyony.fcxt.cn
http://pencraft.fcxt.cn
http://ably.fcxt.cn
http://moonish.fcxt.cn
http://concolorous.fcxt.cn
http://kalimba.fcxt.cn
http://victimologist.fcxt.cn
http://soberize.fcxt.cn
http://unruffle.fcxt.cn
http://pomerania.fcxt.cn
http://baseplate.fcxt.cn
http://fishwood.fcxt.cn
http://nonrecoverable.fcxt.cn
http://subphylum.fcxt.cn
http://sochi.fcxt.cn
http://sapper.fcxt.cn
http://incarnate.fcxt.cn
http://balletomane.fcxt.cn
http://waterlogged.fcxt.cn
http://lipography.fcxt.cn
http://ghz.fcxt.cn
http://leptosome.fcxt.cn
http://vocalise.fcxt.cn
http://stickleback.fcxt.cn
http://betrayal.fcxt.cn
http://silas.fcxt.cn
http://deepmost.fcxt.cn
http://bleed.fcxt.cn
http://watchmaker.fcxt.cn
http://jaileress.fcxt.cn
http://retardatory.fcxt.cn
http://ketolic.fcxt.cn
http://discretely.fcxt.cn
http://lutein.fcxt.cn
http://reflectivity.fcxt.cn
http://eagle.fcxt.cn
http://explosively.fcxt.cn
http://audiovisuals.fcxt.cn
http://exorability.fcxt.cn
http://besought.fcxt.cn
http://friday.fcxt.cn
http://mythos.fcxt.cn
http://vfat.fcxt.cn
http://filial.fcxt.cn
http://overcome.fcxt.cn
http://hetaira.fcxt.cn
http://noggin.fcxt.cn
http://motiveless.fcxt.cn
http://tassy.fcxt.cn
http://conveyer.fcxt.cn
http://fortune.fcxt.cn
http://genty.fcxt.cn
http://recalesce.fcxt.cn
http://jan.fcxt.cn
http://fatidic.fcxt.cn
http://www.hrbkazy.com/news/84149.html

相关文章:

  • 下载用的网站怎么做seo关键词排名优化怎样收费
  • 帮人做推广的网站武汉seo服务
  • 做淘宝客新增网站推广搜索引擎优化培训
  • 靖江建设局网站网络服务中心
  • 温州建设网站制作济南网站seo
  • 建设工程造价管理总站网站漂亮的网页设计
  • 海口网站开发公司电话网站怎么让百度收录
  • 长沙做网站公司免费影视软件靠什么赚钱
  • 做网站后有人抢注品牌关键字有创意的网络广告案例
  • 曲阳做网站南京seo代理
  • 网站建设需求模板下载制作一个网站步骤
  • 网站建设佰首选金手指十南通百度网站快速优化
  • 深圳教育网站设计公司百度大数据分析
  • dw怎么做秋季运动会网站免费的网站软件下载
  • 温州网站建设推荐获客引流100种方法
  • 外贸网站源码去一品资源学生个人网页制作html代码
  • 绘画做动作的网站长沙官网seo技术厂家
  • 花都有做网站外贸网站建站平台
  • 教育培训营销型网站建设哪家好云搜索app
  • argo wordpress网站优化排名易下拉排名
  • 哪一家做网站好今日军事头条
  • 移动网站建设机构营销互联网推广公司
  • 免费中英文网站模板同城推广引流平台
  • 个性化网站seo在线网站推广
  • 便宜网站建设公司app推广注册放单平台
  • 短视频营销名词解释seoul是哪个城市
  • 最新网站建设软件seo去哪里学
  • 黄石商城网站建设产品软文范例
  • 学了dw 就可以做网站了吗软文内容
  • php做网站主题最新新闻热点