Nelze vybrat více než 25 témat Téma musí začínat písmenem nebo číslem, může obsahovat pomlčky („-“) a může být dlouhé až 35 znaků.

HSSFFooter.java 2.1KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. /* ====================================================================
  2. Licensed to the Apache Software Foundation (ASF) under one or more
  3. contributor license agreements. See the NOTICE file distributed with
  4. this work for additional information regarding copyright ownership.
  5. The ASF licenses this file to You under the Apache License, Version 2.0
  6. (the "License"); you may not use this file except in compliance with
  7. the License. You may obtain a copy of the License at
  8. http://www.apache.org/licenses/LICENSE-2.0
  9. Unless required by applicable law or agreed to in writing, software
  10. distributed under the License is distributed on an "AS IS" BASIS,
  11. WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  12. See the License for the specific language governing permissions and
  13. limitations under the License.
  14. ==================================================================== */
  15. package org.apache.poi.hssf.usermodel;
  16. import org.apache.poi.hssf.record.FooterRecord;
  17. import org.apache.poi.hssf.record.aggregates.PageSettingsBlock;
  18. import org.apache.poi.ss.usermodel.Footer;
  19. /**
  20. * Class to read and manipulate the footer.
  21. * <P>
  22. * The footer works by having a left, center, and right side. The total cannot
  23. * be more that 255 bytes long. One uses this class by getting the HSSFFooter
  24. * from HSSFSheet and then getting or setting the left, center, and right side.
  25. * For special things (such as page numbers and date), one can use a the methods
  26. * that return the characters used to represent these. One can also change the
  27. * fonts by using similar methods.
  28. */
  29. public final class HSSFFooter extends HeaderFooter implements Footer {
  30. private final PageSettingsBlock _psb;
  31. protected HSSFFooter(PageSettingsBlock psb) {
  32. _psb = psb;
  33. }
  34. protected String getRawText() {
  35. FooterRecord hf = _psb.getFooter();
  36. if (hf == null) {
  37. return "";
  38. }
  39. return hf.getText();
  40. }
  41. @Override
  42. protected void setHeaderFooterText(String text) {
  43. FooterRecord hfr = _psb.getFooter();
  44. if (hfr == null) {
  45. hfr = new FooterRecord(text);
  46. _psb.setFooter(hfr);
  47. } else {
  48. hfr.setText(text);
  49. }
  50. }
  51. }