正确的格式为Excel US preadsheet [英] correct formatting for excel spreadsheet

查看:142
本文介绍了正确的格式为Excel US preadsheet的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

可能重复:结果
  创建EXCEL US preadsheet

这是为一个文件的正确的格式,以便它在Excel确认?什么性格,如果你手动创建它,表示一列的结束和/或创建一个新行?

What is the correct formatting for a document so that it is recognized in excel? What character, if you are manually creating it, denotes the end of a column and/or create a new line?

我手动创建.xls文件,使用文件系统,并用数据填充它。但是,我不知道是什么的Excel的期望。不,我不希望创建一个.csv文件,因为我不希望用户被要求打开时,它格式化。

I am manually creating a .xls file, using the file system, and populating it with data. However, I don't know what excel expects. No, I don't want to create a .csv file because I don't want the user to be asked to format it when opening it.

感谢

推荐答案

Xls中(以及其他类型的Excel 2007/2010是,你不能很容易地创建这样的二进制fiels,你需要使用COM对象创建和操作他们在这里从脚本专家一个例子<一个href=\"http://blogs.technet.com/b/heyscriptingguy/archive/2005/01/31/how-can-i-make-changes-to-and-then-re-save-an-existing-excel-s$p$padsheet.aspx\" rel=\"nofollow\">http://blogs.technet.com/b/heyscriptingguy/archive/2005/01/31/how-can-i-make-changes-to-and-then-re-save-an-existing-excel-s$p$padsheet.aspx

Xls (and the other types of Excel 2007/2010 are binary fiels that you can not easily create like that, you need to use Com objects to create and manipulate them. Here an example from the scripting guys http://blogs.technet.com/b/heyscriptingguy/archive/2005/01/31/how-can-i-make-changes-to-and-then-re-save-an-existing-excel-spreadsheet.aspx

Set objExcel = CreateObject("Excel.Application")
objExcel.Visible = True
objExcel.DisplayAlerts = FALSE

Set objWorkbook = objExcel.Workbooks.Add
Set objWorksheet = objWorkbook.Worksheets(1)

objWorksheet.Cells(1, 1).Value = Now
objWorkbook.SaveAs("C:\Scripts\Test.xls")
objExcel.Quit

请参见 http://msdn.microsoft。 COM / EN-US /库/ aa223697(v = office.11​​)的.aspx 获得的VBA函数的列表,你可以使用

see http://msdn.microsoft.com/en-us/library/aa223697(v=office.11).aspx for a list of vba functions you can use

如自动格式化所有列是这样的。

eg autoformatting all columns is like this

objWorksheet.columns.autofit;

这篇关于正确的格式为Excel US preadsheet的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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