POITextExtractor.cs 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  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. namespace Tofly.Core.NPOI
  16. {
  17. using System;
  18. /// <summary>
  19. /// Common Parent for Text Extractors
  20. /// of POI Documents.
  21. /// You will typically find the implementation of
  22. /// a given format's text extractor under
  23. /// org.apache.poi.[format].extractor .
  24. /// </summary>
  25. /// @see org.apache.poi.hssf.extractor.ExcelExtractor
  26. /// @see org.apache.poi.hslf.extractor.PowerPointExtractor
  27. /// @see org.apache.poi.hdgf.extractor.VisioTextExtractor
  28. /// @see org.apache.poi.hwpf.extractor.WordExtractor
  29. public abstract class POITextExtractor
  30. {
  31. /** The POIDocument that's open */
  32. protected POIDocument document;
  33. /// <summary>
  34. /// Creates a new text extractor for the given document
  35. /// </summary>
  36. /// <param name="document">The document.</param>
  37. public POITextExtractor(POIDocument document)
  38. {
  39. this.document = document;
  40. }
  41. /// <summary>
  42. /// Creates a new text extractor, using the same
  43. /// document as another text extractor. Normally
  44. /// only used by properties extractors.
  45. /// </summary>
  46. /// <param name="otherExtractor">The other extractor.</param>
  47. protected POITextExtractor(POITextExtractor otherExtractor)
  48. {
  49. this.document = otherExtractor.document;
  50. }
  51. /// <summary>
  52. /// Retrieves all the text from the document.
  53. /// How cells, paragraphs etc are separated in the text
  54. /// is implementation specific - see the javadocs for
  55. /// a specific project for details.
  56. /// </summary>
  57. /// <value>All the text from the document.</value>
  58. public abstract String Text{get;}
  59. /// <summary>
  60. /// Returns another text extractor, which is able to
  61. /// output the textual content of the document
  62. /// metadata / properties, such as author and title.
  63. /// </summary>
  64. /// <value>The metadata text extractor.</value>
  65. public abstract POITextExtractor MetadataTextExtractor{get;}
  66. }
  67. }