1
106
107
108
109 package org.apache.poi.hssf.usermodel;
110
111
112
113 import org.apache.poi.hssf.record.PrintSetupRecord;
114
115
116
117 /**
118
119 * Used to modify the print setup.
120
121 * <P>
122
123 * Paper size constants have been added for the ones I have access
124
125 * to. They follow as:<br>
126
127 * public final short LETTER_PAPERSIZE = 1;<br>
128
129 * public final short LEGAL_PAPERSIZE = 5;<br>
130
131 * public final short EXECUTIVE_PAPERSIZE = 7;<br>
132
133 * public final short A4_PAPERSIZE = 9;<br>
134
135 * public final short A5_PAPERSIZE = 11;<br>
136
137 * public final short ENVELOPE_10_PAPERSIZE = 20;<br>
138
139 * public final short ENVELOPE_DL_PAPERSIZE = 27;<br>
140
141 * public final short ENVELOPE_CS_PAPERSIZE = 28;<br>
142
143 * public final short ENVELOPE_MONARCH_PAPERSIZE = 37;<br>
144
145 * <P>
146
147 * @author Shawn Laubach (slaubach at apache dot org)
148
149 */
150
151 public class HSSFPrintSetup extends Object {
152
153
154
155 public final short LETTER_PAPERSIZE = 1;
156
157 public final short LEGAL_PAPERSIZE = 5;
158
159 public final short EXECUTIVE_PAPERSIZE = 7;
160
161 public final short A4_PAPERSIZE = 9;
162
163 public final short A5_PAPERSIZE = 11;
164
165 public final short ENVELOPE_10_PAPERSIZE = 20;
166
167 public final short ENVELOPE_DL_PAPERSIZE = 27;
168
169 public final short ENVELOPE_CS_PAPERSIZE = 28;
170
171 public final short ENVELOPE_MONARCH_PAPERSIZE = 37;
172
173
174
175 PrintSetupRecord printSetupRecord;
176
177
178
179 /**
180
181 * Constructor. Takes the low level print setup record.
182
183 * @param printSetupRecord the low level print setup record
184
185 */
186
187 protected HSSFPrintSetup(PrintSetupRecord printSetupRecord) {
188
189 this.printSetupRecord = printSetupRecord;
190
191 }
192
193
194
195 /**
196
197 * Set the paper size.
198
199 * @param size the paper size.
200
201 */
202
203 public void setPaperSize(short size)
204
205 {
206
207 printSetupRecord.setPaperSize(size);
208
209 }
210
211
212
213 /**
214
215 * Set the scale.
216
217 * @param scale the scale to use
218
219 */
220
221 public void setScale(short scale)
222
223 {
224
225 printSetupRecord.setScale(scale);
226
227 }
228
229
230
231 /**
232
233 * Set the page numbering start.
234
235 * @param start the page numbering start
236
237 */
238
239 public void setPageStart(short start)
240
241 {
242
243 printSetupRecord.setPageStart(start);
244
245 }
246
247
248
249 /**
250
251 * Set the number of pages wide to fit the sheet in
252
253 * @param width the number of pages
254
255 */
256
257 public void setFitWidth(short width)
258
259 {
260
261 printSetupRecord.setFitWidth(width);
262
263 }
264
265
266
267 /**
268
269 * Set the number of pages high to fit the sheet in
270
271 * @param height the number of pages
272
273 */
274
275 public void setFitHeight(short height)
276
277 {
278
279 printSetupRecord.setFitHeight(height);
280
281 }
282
283
284
285
286
287 /**
288
289 * Sets the options flags. Not advisable to do it directly.
290
291 * @param options The bit flags for the options
292
293 */
294
295 public void setOptions(short options)
296
297 {
298
299 printSetupRecord.setOptions(options);
300
301 }
302
303
304
305
306
307 /**
308
309 * Set whether to go left to right or top down in ordering
310
311 * @param ltor left to right
312
313 */
314
315 public void setLeftToRight(boolean ltor)
316
317 {
318
319 printSetupRecord.setLeftToRight(ltor);
320
321 }
322
323
324
325 /**
326
327 * Set whether to print in landscape
328
329 * @param ls landscape
330
331 */
332
333 public void setLandscape(boolean ls)
334
335 {
336
337 printSetupRecord.setLandscape(!ls);
338
339 }
340
341
342
343 /**
344
345 * Valid settings. I'm not for sure.
346
347 * @param valid Valid
348
349 */
350
351 public void setValidSettings(boolean valid)
352
353 {
354
355 printSetupRecord.setValidSettings(valid);
356
357 }
358
359
360
361
362
363 /**
364
365 * Set whether it is black and white
366
367 * @param mono Black and white
368
369 */
370
371 public void setNoColor(boolean mono)
372
373 {
374
375 printSetupRecord.setNoColor(mono);
376
377 }
378
379
380
381 /**
382
383 * Set whether it is in draft mode
384
385 * @param d draft
386
387 */
388
389 public void setDraft(boolean d)
390
391 {
392
393 printSetupRecord.setDraft(d);
394
395 }
396
397
398
399 /**
400
401 * Print the include notes
402
403 * @param printnotes print the notes
404
405 */
406
407 public void setNotes(boolean printnotes)
408
409 {
410
411 printSetupRecord.setNotes(printnotes);
412
413 }
414
415
416
417 /**
418
419 * Set no orientation. ?
420
421 * @param orientation Orientation.
422
423 */
424
425 public void setNoOrientation(boolean orientation)
426
427 {
428
429 printSetupRecord.setNoOrientation(orientation);
430
431 }
432
433
434
435 /**
436
437 * Set whether to use page start
438
439 * @param page Use page start
440
441 */
442
443 public void setUsePage(boolean page)
444
445 {
446
447 printSetupRecord.setUsePage(page);
448
449 }
450
451
452
453 /**
454
455 * Sets the horizontal resolution.
456
457 * @param resolution horizontal resolution
458
459 */
460
461 public void setHResolution(short resolution)
462
463 {
464
465 printSetupRecord.setHResolution(resolution);
466
467 }
468
469
470
471 /**
472
473 * Sets the vertical resolution.
474
475 * @param resolution vertical resolution
476
477 */
478
479 public void setVResolution(short resolution)
480
481 {
482
483 printSetupRecord.setVResolution(resolution);
484
485 }
486
487
488
489 /**
490
491 * Sets the header margin.
492
493 * @param headermargin header margin
494
495 */
496
497 public void setHeaderMargin(double headermargin)
498
499 {
500
501 printSetupRecord.setHeaderMargin(headermargin);
502
503 }
504
505
506
507 /**
508
509 * Sets the footer margin.
510
511 * @param footermargin footer margin
512
513 */
514
515 public void setFooterMargin(double footermargin)
516
517 {
518
519 printSetupRecord.setFooterMargin(footermargin);
520
521 }
522
523
524
525 /**
526
527 * Sets the number of copies.
528
529 * @param copies number of copies
530
531 */
532
533 public void setCopies(short copies)
534
535 {
536
537 printSetupRecord.setCopies(copies);
538
539 }
540
541
542
543 /**
544
545 * Returns the paper size.
546
547 * @return paper size
548
549 */
550
551 public short getPaperSize()
552
553 {
554
555 return printSetupRecord.getPaperSize();
556
557 }
558
559
560
561 /**
562
563 * Returns the scale.
564
565 * @return scale
566
567 */
568
569 public short getScale()
570
571 {
572
573 return printSetupRecord.getScale();
574
575 }
576
577
578
579 /**
580
581 * Returns the page start.
582
583 * @return page start
584
585 */
586
587 public short getPageStart()
588
589 {
590
591 return printSetupRecord.getPageStart();
592
593 }
594
595
596
597 /**
598
599 * Returns the number of pages wide to fit sheet in.
600
601 * @return number of pages wide to fit sheet in
602
603 */
604
605 public short getFitWidth()
606
607 {
608
609 return printSetupRecord.getFitWidth();
610
611 }
612
613
614
615 /**
616
617 * Returns the number of pages high to fit the sheet in.
618
619 * @return number of pages high to fit the sheet in
620
621 */
622
623 public short getFitHeight()
624
625 {
626
627 return printSetupRecord.getFitHeight();
628
629 }
630
631
632
633 /**
634
635 * Returns the bit flags for the options.
636
637 * @return bit flags for the options
638
639 */
640
641 public short getOptions()
642
643 {
644
645 return printSetupRecord.getOptions();
646
647 }
648
649
650
651 /**
652
653 * Returns the left to right print order.
654
655 * @return left to right print order
656
657 */
658
659 public boolean getLeftToRight()
660
661 {
662
663 return printSetupRecord.getLeftToRight();
664
665 }
666
667
668
669 /**
670
671 * Returns the landscape mode.
672
673 * @return landscape mode
674
675 */
676
677 public boolean getLandscape()
678
679 {
680
681 return !printSetupRecord.getLandscape();
682
683 }
684
685
686
687 /**
688
689 * Returns the valid settings.
690
691 * @return valid settings
692
693 */
694
695 public boolean getValidSettings()
696
697 {
698
699 return printSetupRecord.getValidSettings();
700
701 }
702
703
704
705 /**
706
707 * Returns the black and white setting.
708
709 * @return black and white setting
710
711 */
712
713 public boolean getNoColor()
714
715 {
716
717 return printSetupRecord.getNoColor();
718
719 }
720
721
722
723 /**
724
725 * Returns the draft mode.
726
727 * @return draft mode
728
729 */
730
731 public boolean getDraft()
732
733 {
734
735 return printSetupRecord.getDraft();
736
737 }
738
739
740
741 /**
742
743 * Returns the print notes.
744
745 * @return print notes
746
747 */
748
749 public boolean getNotes()
750
751 {
752
753 return printSetupRecord.getNotes();
754
755 }
756
757
758
759 /**
760
761 * Returns the no orientation.
762
763 * @return no orientation
764
765 */
766
767 public boolean getNoOrientation()
768
769 {
770
771 return printSetupRecord.getNoOrientation();
772
773 }
774
775
776
777 /**
778
779 * Returns the use page numbers.
780
781 * @return use page numbers
782
783 */
784
785 public boolean getUsePage()
786
787 {
788
789 return printSetupRecord.getUsePage();
790
791 }
792
793
794
795 /**
796
797 * Returns the horizontal resolution.
798
799 * @return horizontal resolution
800
801 */
802
803 public short getHResolution()
804
805 {
806
807 return printSetupRecord.getHResolution();
808
809 }
810
811
812
813 /**
814
815 * Returns the vertical resolution.
816
817 * @return vertical resolution
818
819 */
820
821 public short getVResolution()
822
823 {
824
825 return printSetupRecord.getVResolution();
826
827 }
828
829
830
831 /**
832
833 * Returns the header margin.
834
835 * @return header margin
836
837 */
838
839 public double getHeaderMargin()
840
841 {
842
843 return printSetupRecord.getHeaderMargin();
844
845 }
846
847
848
849 /**
850
851 * Returns the footer margin.
852
853 * @return footer margin
854
855 */
856
857 public double getFooterMargin()
858
859 {
860
861 return printSetupRecord.getFooterMargin();
862
863 }
864
865
866
867 /**
868
869 * Returns the number of copies.
870
871 * @return number of copies
872
873 */
874
875 public short getCopies()
876
877 {
878
879 return printSetupRecord.getCopies();
880
881 }
882
883 }
884
885 HSSFPrintSetupObjectLETTER_PAPERSIZELEGAL_PAPERSIZEEXECUTIVE_PAPERSIZEA4_PAPERSIZEA5_PAPERSIZEENVELOPE_10_PAPERSIZEENVELOPE_DL_PAPERSIZEENVELOPE_CS_PAPERSIZEENVELOPE_MONARCH_PAPERSIZEPrintSetupRecordprintSetupRecordHSSFPrintSetupPrintSetupRecordprintSetupRecordsetPaperSizeprintSetupRecordsetPaperSizesizesetScaleprintSetupRecordsetScalescalesetPageStartprintSetupRecordsetPageStartstartsetFitWidthprintSetupRecordsetFitWidthwidthsetFitHeightprintSetupRecordsetFitHeightheightsetOptionsprintSetupRecordsetOptionsoptionssetLeftToRightprintSetupRecordsetLeftToRightltorsetLandscapeprintSetupRecordsetLandscapelssetValidSettingsprintSetupRecordsetValidSettingsvalidsetNoColorprintSetupRecordsetNoColormonosetDraftprintSetupRecordsetDraftdsetNotesprintSetupRecordsetNotesprintnotessetNoOrientationprintSetupRecordsetNoOrientationorientationsetUsePageprintSetupRecordsetUsePagepagesetHResolutionprintSetupRecordsetHResolutionresolutionsetVResolutionprintSetupRecordsetVResolutionresolutionsetHeaderMarginprintSetupRecordsetHeaderMarginheadermarginsetFooterMarginprintSetupRecordsetFooterMarginfootermarginsetCopiesprintSetupRecordsetCopiescopiesgetPaperSizeprintSetupRecordgetPaperSizegetScaleprintSetupRecordgetScalegetPageStartprintSetupRecordgetPageStartgetFitWidthprintSetupRecordgetFitWidthgetFitHeightprintSetupRecordgetFitHeightgetOptionsprintSetupRecordgetOptionsgetLeftToRightprintSetupRecordgetLeftToRightgetLandscapeprintSetupRecordgetLandscapegetValidSettingsprintSetupRecordgetValidSettingsgetNoColorprintSetupRecordgetNoColorgetDraftprintSetupRecordgetDraftgetNotesprintSetupRecordgetNotesgetNoOrientationprintSetupRecordgetNoOrientationgetUsePageprintSetupRecordgetUsePagegetHResolutionprintSetupRecordgetHResolutiongetVResolutionprintSetupRecordgetVResolutiongetHeaderMarginprintSetupRecordgetHeaderMargingetFooterMarginprintSetupRecordgetFooterMargingetCopiesprintSetupRecordgetCopies