使用perl的列宽自动拟合功能 [英] Column Width autofit functionality using perl

查看:77
本文介绍了使用perl的列宽自动拟合功能的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经使用perl脚本使用一组csv文件生成了excel工作表,因为我需要将列的宽度设置为 auto-fit .在称为OLE的模块中执行此操作的方法我不知道该如何执行,请帮助我?

I have generated the excel sheet using set of csv files using perl script.In that i need to set width of the column as auto-fit.What 'm suppose to do i've got The way to do this in the module called OLE i don't know how to do this you please help me?

推荐答案

无法将文件的列设置为自动调整",因为这不是文件的设置. Excel对此进行计算并在运行时设置列宽.

There is no way to set a file's column to "AutoFit" because that is not a setting of the file. Excel calculates this and sets a column width at run-time.

一种选择是根据您自己的数据自行计算自动调整"宽度,然后将列宽设置为您计算出的值. 此讨论提供了一些解决方法.

One option is to calculate the "AutoFit" width yourself based on your data, and then set the column width to the value that you calculate. This discussion gives some workaround code that does that.

另一种选择是使用Win32::OLE 将列设置为自动调整".该模块本身未记录如何执行此操作.您将不得不在Microsoft OLE文档中搜索以找到适当的命令.

Another option is to use Win32::OLE to set the column to AutoFit. How to do this is not documented in the module itself; you would have to search around the Microsoft OLE documentation to find the appropriate command.

更新:此网站似乎在显示如何使用AutoFit与Win32::OLE.

Update: This site appears to show how to use AutoFit with Win32::OLE.

这篇关于使用perl的列宽自动拟合功能的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆