请问各位大虾,我数据库中有html代码,如何将他们生成word文档?

解决方案 »

  1.   

    怎么没人回答啊?第一次发帖就没人理,深受打击ing
      

  2.   

    这个估计比较难,你是想html的页面内容转成word 还是把html当成txt转成word?
    我只见过把word转成其他的格式,没见过转成word的。
      

  3.   

    是想吧html页面内容转换成word,html还包含图片的,居然这么难,那可郁闷了啊
      

  4.   

    下面是将Memo1.Text写入到word,你换成你的html就行了var
      NewDocument: _Document;
      ItemIndex: OleVariant;
    begin
      WordApplication1.Disconnect;
      WordDocument1.Disconnect;
      ItemIndex :=1;
      NewDocument := WordApplication1.Documents.Add(EmptyParam,EmptyParam,EmptyParam,EmptyParam);
      WordDocument1.ConnectTo(NewDocument);
      WordDocument1.Windows.Item(ItemIndex).Caption := '口算';
      WordApplication1.Visible := True;
      WordDocument1.Windows.Item(ItemIndex).Document.Paragraphs.Item(ItemIndex).Range.Font.Size := Memo1.Font.Size;
      WordDocument1.Windows.Item(ItemIndex).Document.Paragraphs.Item(ItemIndex).Range.Font.Name := Memo1.Font.Name;
      if fsBold in Memo1.Font.Style then
        WordDocument1.Windows.Item(ItemIndex).Document.Paragraphs.Item(ItemIndex).Range.Font.Bold := 1
      else
        WordDocument1.Windows.Item(ItemIndex).Document.Paragraphs.Item(ItemIndex).Range.Font.Bold := 0;
      WordDocument1.Range.InsertBefore(Memo1.Text);
    end;
      

  5.   

    谢谢bdmh,请问下,如果是想把整个html页面的图片也加入该如何做呢?另外,这种方式html标签也会被加进去,显示能正常吗?