转贴:Delphi Office 组件集常见问答[3]

[入库:2005年8月18日] [更新:2007年3月24日]

本文简介:选择自 dogbear2000 的 blog

    emptyparam, // forward
    emptyparam, // wrap
    emptyparam, // format
    replacetext, // replace with
    replace, // replace
    emptyparam, // match kashida
    emptyparam, // match diacritics
    emptyparam, // match alefhamza
    emptyparam); // match control

q16. how do i close excel worksheet?

excelworkbook1.close(false, // save changes
  emptyparam, // filename
  emptyparam); // route workbook

q17. how do i save the specified word document in html format?

var
  filename: olevariant;
  fileformat: olevariant;

filename := 'c:\mydoc.html';
fileformat := wdformathtml;

worddocument1.saveas(filename, // document name
  fileformat, // file format
  emptyparam, // lock the document for comments
  emptyparam, // password for opening the document
  emptyparam, // add the document to the list of recently used files
  emptyparam, // password for saving changes to the document
  emptyparam, // word suggest read-only status
  emptyparam, // save truetype fonts with the document
  emptyparam, // save only the windows version of the imported graphics
  emptyparam, // save the form data
  emptyparam); // save the document as aoce letter (the mailer is saved)

q18. how do i insert the current page number at the begining of each line?

with worddocument1.worddocument.paragraphs do
  for i := 1 to count do
    with item(i).range do
    begin
      end_ := start; // select start of range (line)
      text := inttostr(information[wdactiveendadjustedpagenumber]) + ': '; // add text
    end

q19. how do i specify a workbook name?

excelworkbook1.saveas('myworkbook.xls', emptyparam, emptyparam, emptyparam, emptyparam,
  emptyparam, xlnochange, emptyparam, emptyparam, emptyparam, emptyparam);

q20. how do i specify a worksheet name?

excelworksheet1.excelworksheet.name := 'myworksheet';

q21. how do i draw a line in excel worksheet?

// draw line from (10, 10) to (300, 300)
// x, y measured in points

excelworksheet1.excelworksheet.shapes.addline(10, 10, 300, 300);

q22. how do i place a picture into worksheet?

excelworksheet1.excelworksheet.shapes.addpicture(
  'c:\mybitmap.bmp', // filename
  msofalse, // linktofile (true = make link to file, false = make copy of the file in document)
  msoctrue, // savewithdocument (must be true if linktofile is false)
  10, // left
  10, // top
  300, // width
  300); // height

q23. how do i open a password protected workbook?

excelapplication1.excelapplication.workbooks.open(
  'c:\myworkbook.xls', // filename
  3, // updatelinks

本文关键:转贴:Delphi Office 组件集常见问答
  相关方案
Google
 

本站最佳浏览方式为 分辨率 1024x768 IE 6.0(或更高版本的 IE浏览器)

go top