Get cursor before insert a Document

The Application Programming Interface and the OASIS Open Document Format

Get cursor before insert a Document

Postby Peter18 » Wed Oct 26, 2011 5:50 pm

A friendly hello to anybody,

I tried to insert a document into a writer document via Delphi 4. It works with a writer doc. But not with a MS-Word doc.

Code: Select all   Expand viewCollapse view
procedure OOInsertDoc( OO: T_OO; Fil: String; Err: T_Error );
var
  Par : OLEVariant;
  Path : String;
begin
  if LowerCase( GetExt(Fil) ) = '.doc' then
  begin
    Par          := VarArrayCreate([0, 0], varVariant);
    Par[0]       := OO.OpenOffice.Bridge_GetStruct('com.sun.star.beans.PropertyValue');
    Par[0].Name  := 'FilterName';
    Par[0].Value := 'MS Word 97';
    Path := OO.FCP.getFileURLFromSystemPath('', Fil);
    OO.Cur.insertDocumentFromURL( Path, Par );
  end
  else
  begin
    Path := OO.FCP.getFileURLFromSystemPath('', Fil);
    OO.Cur.insertDocumentFromURL( Path, VarArrayCreate([0, - 1], varVariant) );
  end;
end;

If I insert a MS-Word doc, the result is: No text, but a pagebreak. I would like to see the text within the page at cursor position.

With the hope, anybody can help, thank you.

Greetings

Peter
OpenOffice 3.3; OpenOffice 4.1.1
Peter18
 
Posts: 99
Joined: Thu May 12, 2011 1:01 pm

Return to UNO API and ODF

Who is online

Users browsing this forum: No registered users and 1 guest