1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51
|
procedure ImprimerPagesDeA(OOoNomFeuille: variant; De, A, nbPages : integer; Zoom_Page : integer=100);
Var
PrinterOpt : variant;
PropertyValue : Variant;
Size: Variant;
Width: Integer;
begin
CoreReflection := OpenOffice.createInstance('com.sun.star.reflection.CoreReflection');
CoreReflection
.forName('com.sun.star.beans.PropertyValue')
.createObject(propertyValue);
printerOpt := VarArrayCreate([0, 1], varVariant);
propertyValue.Name := 'Pages';
propertyValue.Value := IntToStr(De) + '-' + IntToStr(A); //'1-2';
printerOpt[0] := propertyValue;
propertyValue.Name := 'CopyCount';
propertyValue.Value := NbPages; //2;
printerOpt[1] := propertyValue;
PageStyleCollection := DocumentOpenOffice.StyleFamilies.getByName('PageStyles');
PropertySet := PageStyleCollection.getByName(OOoMaFeuille.PageStyle);
if not PropertySet.IsLandscape then
begin
//.. c'est dans ce bloc qu'il faut inclure ttes les propriétés de style de
//.. page dont on a besoin
Size := PropertySet.Size;
Width := Size.Width;
Size.Width := Size.Height;
Size.Height := Width;
PropertySet.Size := Size;
PropertySet.IsLandscape := True;
PropertySet.PageScale := Zoom_Page;//.. Zoom à 80% n'a pas l'air de marcher
PropertySet.HeaderIsOn := False; //.. Pas d'en-tête (..nom de la feuille..)
PropertySet.FooterIsOn := False; //.. Pas de bas de page (..N° de la page..)
PropertySet.CenterVertically := True; //.. Centrage vertical du tableau
PropertySet.CenterHorizontally := True; //.. Centrage horizoncal du tableau
PropertySet.TopMargin := 500; //.. Marge partie haut de page en 1/100 de mm
PropertySet.BottomMargin := 500; //.. Marge partie bas de page en 1/100 de mm
end;
DocumentOpenOffice.print(PrinterOpt); |
Partager