Ignore:
Timestamp:
06/25/11 11:45:55 (11 months ago)
Author:
jharrop
Message:

Rework/cleanup PageDimensions?

Location:
trunk/docx4j/src/main/java/org/docx4j/openpackaging
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/docx4j/src/main/java/org/docx4j/openpackaging/packages/WordprocessingMLPackage.java

    r1536 r1567  
    408408                // Create a basic sectPr using our Page model 
    409409                PageDimensions page = new PageDimensions(); 
     410                page.setPgSize(sz, landscape); 
     411                 
    410412                SectPr sectPr = factory.createSectPr(); 
    411413                body.setSectPr(sectPr); 
    412                 sectPr.setPgSz(PageDimensions.createPgSize(sz, landscape) ); 
    413                 sectPr.setPgMar(page.createPgMar()); 
     414                sectPr.setPgSz(  page.getPgSz() ); 
     415                sectPr.setPgMar( page.getPgMar() ); 
    414416                                 
    415417                // Put the content in the part 
  • trunk/docx4j/src/main/java/org/docx4j/openpackaging/parts/DrawingML/CreateDocxWithSmartArt.java

    r1544 r1567  
    6767                        MarginsWellKnown margins,  
    6868                        Document xml) throws Exception { 
    69                  
    70                 // TODO: pass in page size and orientation, 
    71                 // and scale the SmartArt to fill the page. 
    72                                  
     69                                                 
    7370                // Make a basic docx 
    7471                WordprocessingMLPackage wordMLPackage = WordprocessingMLPackage.createPackage(sz, landscape);            
     
    9794 
    9895                // Occupy entire page, less margins 
    99                 PgSz pgSz = PageDimensions.createPgSize(sz, landscape ); 
    10096                PageDimensions pd = new PageDimensions(); 
     97                pd.setPgSize(sz, landscape ); 
     98                PgSz pgSz = pd.getPgSz();  
    10199                pd.setMargins(margins); 
    102                 String cx =  ""+UnitsOfMeasurement.twipToEMU(pgSz.getW().intValue() - (pd.getMarginLeft()+pd.getMarginRight() ) );  //"5486400"; 
    103                 String cy = ""+UnitsOfMeasurement.twipToEMU(pgSz.getH().intValue() - (pd.getMarginTop()+pd.getMarginBottom() ));   //"3200400"; 
     100                String cx =  ""+UnitsOfMeasurement.twipToEMU(pgSz.getW().intValue()  
     101                                - (pd.getPgMar().getLeft().intValue()+pd.getPgMar().getRight().intValue() ) );  //"5486400"; 
     102                String cy = ""+UnitsOfMeasurement.twipToEMU(pgSz.getH().intValue()  
     103                                - (pd.getPgMar().getTop().intValue()+pd.getPgMar().getBottom().intValue() ));   //"3200400"; 
    104104                 
    105105                // Now use it in the docx 
Note: See TracChangeset for help on using the changeset viewer.