Vous ne pouvez pas sélectionner plus de 25 sujets Les noms de sujets doivent commencer par une lettre ou un nombre, peuvent contenir des tirets ('-') et peuvent comporter jusqu'à 35 caractères.

GridsetRecord.java 2.8KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596
  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.record;
  16. import java.util.Map;
  17. import java.util.function.Supplier;
  18. import org.apache.poi.util.GenericRecordUtil;
  19. import org.apache.poi.util.LittleEndianOutput;
  20. /**
  21. * Flag denoting whether the user specified that gridlines are used when printing.
  22. *
  23. * @version 2.0-pre
  24. */
  25. public final class GridsetRecord extends StandardRecord {
  26. public static final short sid = 0x82;
  27. private short field_1_gridset_flag;
  28. public GridsetRecord() {}
  29. public GridsetRecord(GridsetRecord other) {
  30. super(other);
  31. field_1_gridset_flag = other.field_1_gridset_flag;
  32. }
  33. public GridsetRecord(RecordInputStream in) {
  34. field_1_gridset_flag = in.readShort();
  35. }
  36. /**
  37. * set whether gridlines are visible when printing
  38. *
  39. * @param gridset - <b>true</b> if no gridlines are print, <b>false</b> if gridlines are not print.
  40. */
  41. public void setGridset(boolean gridset) {
  42. if (gridset) {
  43. field_1_gridset_flag = 1;
  44. } else {
  45. field_1_gridset_flag = 0;
  46. }
  47. }
  48. /**
  49. * get whether the gridlines are shown during printing.
  50. *
  51. * @return gridset - true if gridlines are NOT printed, false if they are.
  52. */
  53. public boolean getGridset()
  54. {
  55. return (field_1_gridset_flag == 1);
  56. }
  57. public void serialize(LittleEndianOutput out) {
  58. out.writeShort(field_1_gridset_flag);
  59. }
  60. protected int getDataSize() {
  61. return 2;
  62. }
  63. public short getSid()
  64. {
  65. return sid;
  66. }
  67. @Override
  68. public GridsetRecord copy() {
  69. return new GridsetRecord(this);
  70. }
  71. @Override
  72. public HSSFRecordTypes getGenericRecordType() {
  73. return HSSFRecordTypes.GRIDSET;
  74. }
  75. @Override
  76. public Map<String, Supplier<?>> getGenericProperties() {
  77. return GenericRecordUtil.getGenericProperties("gridset", this::getGridset);
  78. }
  79. }