请教如何利用OLE的方法将 EXCEL电子表格另存为XML格式文件(利用DELPHI实现)(100分)

  • 主题发起人 主题发起人 秦人
  • 开始时间 开始时间

秦人

Unregistered / Unconfirmed
GUEST, unregistred user!
我目前已经知道的另存为Html的方法
Var
ExcelApp,MyWorkBook: OLEVariant;
begin
try
ExcelApp:=CreateOleObject('Excel.Application');
MyWorkBook:=CreateOleobject('Excel.Sheet');
except
application.Messagebox('请检查Excel是否正确安装!','错误',MB_OK);
Exit;
end;
if OpenDialog1.Execute then
MyworkBook:= ExcelApp.workBooks.Open(OpenDialog1.FileName);
MyworkBook.SaveAs( 'C:/Demo.Html',XLHTML);//XLHTML 这个参数为文件类型,
{不知道可以不可以 替换为 XML文件类型}
ExcelApp:=Unassigned; //释放VARIANT变量
 
怎么都没有人感兴趣啊,着急啊,自己顶上去一下[:(]
 
这个要 Excel XP 以上才支持的,引用 ExcelXP 单元,使用如下代码:
MyworkBook.SaveAs('D:/Demo.xml', xlXMLSpreadsheet);
即可
可以看看 C:/Program Files/Borland/Delphi7/Ocx/Servers 下的 ExcelXP 所有定义

const
xlAddIn = $00000012;
xlCSV = $00000006;
xlCSVMac = $00000016;
xlCSVMSDOS = $00000018;
xlCSVWindows = $00000017;
xlDBF2 = $00000007;
xlDBF3 = $00000008;
xlDBF4 = $0000000B;
xlDIF = $00000009;
xlExcel2 = $00000010;
xlExcel2FarEast = $0000001B;
xlExcel3 = $0000001D;
xlExcel4 = $00000021;
xlExcel5 = $00000027;
xlExcel7 = $00000027;
xlExcel9795 = $0000002B;
xlExcel4Workbook = $00000023;
xlIntlAddIn = $0000001A;
xlIntlMacro = $00000019;
xlWorkbookNormal = $FFFFEFD1;
xlSYLK = $00000002;
xlTemplate = $00000011;
xlCurrentPlatformText = $FFFFEFC2;
xlTextMac = $00000013;
xlTextMSDOS = $00000015;
xlTextPrinter = $00000024;
xlTextWindows = $00000014;
xlWJ2WD1 = $0000000E;
xlWK1 = $00000005;
xlWK1ALL = $0000001F;
xlWK1FMT = $0000001E;
xlWK3 = $0000000F;
xlWK4 = $00000026;
xlWK3FM3 = $00000020;
xlWKS = $00000004;
xlWorks2FarEast = $0000001C;
xlWQ1 = $00000022;
xlWJ3 = $00000028;
xlWJ3FJ3 = $00000029;
xlUnicodeText = $0000002A;
xlHtml = $0000002C;
xlWebArchive = $0000002D;
xlXMLSpreadsheet = $0000002E;
 
非常感谢,我想找的就是这个 参数的 定义 .分是你的.
 
后退
顶部