我已经实现了把数据库的数据倒入excel中打印,但是不知道怎么让所有文字居中。
这是我程序中的两个语句,其余省略了
……
Excelapp.cells[1,2].value := '上午';
……
excelapp.ActiveSheet.Range('A1:f20').HorizontalAlignment :=xlcenter;
……运行报错:Undeclared identifier: 'xlCenter'
我装的delphi7、office xp。
请教各位高手,到底要怎么实现所有文字居中

解决方案 »

  1.   

    excelapp.ActiveSheet.Range('A1:f20').HorizontalAlignment :=3
      

  2.   

    看看excelxp.pas
    use
    excelxp
      

  3.   

    const xlCenter = $FFFFEFF4;
      

  4.   

    windwather() :用了你的方法在运行的时候报错:
    project project1.exe raised exception class EOLeSysError with message '找不到成员。'.Process stopped.
      

  5.   

    firetoucher(风焱):
    看看excelxp.pas
    use
    excelxp
    这是什么意思?
      

  6.   

    在你的unit的use里加入excelxp单元--注意路径
      

  7.   

    问题已经解决,用下面的语句:
    Excelapp.Range['A1:f20'].HorizontalAlignment := xlCenter;