You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

HSSFCreationHelper.java 2.9KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889
  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.common.usermodel.HyperlinkType;
  17. import org.apache.poi.hssf.record.common.ExtendedColor;
  18. import org.apache.poi.ss.usermodel.CreationHelper;
  19. import org.apache.poi.util.Internal;
  20. import org.apache.poi.util.Removal;
  21. public class HSSFCreationHelper implements CreationHelper {
  22. private final HSSFWorkbook workbook;
  23. /**
  24. * Should only be called by {@link HSSFWorkbook#getCreationHelper()}
  25. *
  26. * @param wb the workbook to create objects for
  27. */
  28. @Internal(since="3.15 beta 3")
  29. /*package*/ HSSFCreationHelper(HSSFWorkbook wb) {
  30. workbook = wb;
  31. }
  32. @Override
  33. public HSSFRichTextString createRichTextString(String text) {
  34. return new HSSFRichTextString(text);
  35. }
  36. @Override
  37. public HSSFDataFormat createDataFormat() {
  38. return workbook.createDataFormat();
  39. }
  40. /**
  41. * {@inheritDoc}
  42. * @deprecated POI 3.15 beta 3. Use {@link #createHyperlink(HyperlinkType)} instead.
  43. */
  44. @Deprecated
  45. @Removal(version="3.17")
  46. @Override
  47. public HSSFHyperlink createHyperlink(int type) {
  48. return new HSSFHyperlink(type);
  49. }
  50. @Override
  51. public HSSFHyperlink createHyperlink(HyperlinkType type) {
  52. return new HSSFHyperlink(type);
  53. }
  54. @Override
  55. public HSSFExtendedColor createExtendedColor() {
  56. return new HSSFExtendedColor(new ExtendedColor());
  57. }
  58. /**
  59. * Creates a HSSFFormulaEvaluator, the object that evaluates formula cells.
  60. *
  61. * @return a HSSFFormulaEvaluator instance
  62. */
  63. @Override
  64. public HSSFFormulaEvaluator createFormulaEvaluator(){
  65. return new HSSFFormulaEvaluator(workbook);
  66. }
  67. /**
  68. * Creates a HSSFClientAnchor. Use this object to position drawing object in a sheet
  69. *
  70. * @return a HSSFClientAnchor instance
  71. * @see org.apache.poi.ss.usermodel.Drawing
  72. */
  73. @Override
  74. public HSSFClientAnchor createClientAnchor(){
  75. return new HSSFClientAnchor();
  76. }
  77. }