git-svn-id: https://svn.apache.org/repos/asf/poi/tags/REL_3_16_BETA1@1769473 13f79535-47bb-0310-9956-ffa450edef68tags/REL_3_16_BETA1^0
@@ -40,7 +40,7 @@ under the License. | |||
<description>The Apache POI project Ant build.</description> | |||
<property name="version.id" value="3.16-beta2"/> | |||
<property name="version.id" value="3.16-beta1"/> | |||
<property name="release.rc" value="RC1"/> | |||
<property environment="env"/> |
@@ -6,7 +6,7 @@ | |||
<parent> | |||
<groupId>org.apache.poi</groupId> | |||
<artifactId>poi-parent</artifactId> | |||
<version>3.16-beta2-SNAPSHOT</version> | |||
<version>3.16-beta1-SNAPSHOT</version> | |||
</parent> | |||
<artifactId>poi-examples</artifactId> | |||
<packaging>jar</packaging> |
@@ -6,7 +6,7 @@ | |||
<parent> | |||
<groupId>org.apache.poi</groupId> | |||
<artifactId>poi-parent</artifactId> | |||
<version>3.16-beta2-SNAPSHOT</version> | |||
<version>3.16-beta1-SNAPSHOT</version> | |||
</parent> | |||
<artifactId>poi-excelant</artifactId> | |||
<packaging>jar</packaging> |
@@ -6,7 +6,7 @@ | |||
<parent> | |||
<groupId>org.apache.poi</groupId> | |||
<artifactId>poi-parent</artifactId> | |||
<version>3.16-beta2-SNAPSHOT</version> | |||
<version>3.16-beta1-SNAPSHOT</version> | |||
</parent> | |||
<artifactId>poi-main</artifactId> | |||
<packaging>jar</packaging> |
@@ -6,7 +6,7 @@ | |||
<parent> | |||
<groupId>org.apache.poi</groupId> | |||
<artifactId>poi-parent</artifactId> | |||
<version>3.16-beta2-SNAPSHOT</version> | |||
<version>3.16-beta1-SNAPSHOT</version> | |||
<relativePath>..</relativePath> | |||
</parent> | |||
<artifactId>poi-ooxml-schema-encryption</artifactId> |
@@ -6,7 +6,7 @@ | |||
<parent> | |||
<groupId>org.apache.poi</groupId> | |||
<artifactId>poi-parent</artifactId> | |||
<version>3.16-beta2-SNAPSHOT</version> | |||
<version>3.16-beta1-SNAPSHOT</version> | |||
<relativePath>..</relativePath> | |||
</parent> | |||
<artifactId>poi-ooxml-schema-security</artifactId> |
@@ -6,7 +6,7 @@ | |||
<parent> | |||
<groupId>org.apache.poi</groupId> | |||
<artifactId>poi-parent</artifactId> | |||
<version>3.16-beta2-SNAPSHOT</version> | |||
<version>3.16-beta1-SNAPSHOT</version> | |||
<relativePath>..</relativePath> | |||
</parent> | |||
<artifactId>poi-ooxml-schema</artifactId> |
@@ -6,7 +6,7 @@ | |||
<parent> | |||
<groupId>org.apache.poi</groupId> | |||
<artifactId>poi-parent</artifactId> | |||
<version>3.16-beta2-SNAPSHOT</version> | |||
<version>3.16-beta1-SNAPSHOT</version> | |||
</parent> | |||
<artifactId>poi-ooxml</artifactId> | |||
<packaging>jar</packaging> |
@@ -3,7 +3,7 @@ | |||
<groupId>org.apache.poi</groupId> | |||
<artifactId>poi-parent</artifactId> | |||
<packaging>pom</packaging> | |||
<version>3.16-beta2-SNAPSHOT</version> | |||
<version>3.16-beta1-SNAPSHOT</version> | |||
<name>Apache POI - the Java API for Microsoft Documents</name> | |||
<description>Maven build of Apache POI for Sonar checks</description> | |||
<url>http://poi.apache.org/</url> |
@@ -6,7 +6,7 @@ | |||
<parent> | |||
<groupId>org.apache.poi</groupId> | |||
<artifactId>poi-parent</artifactId> | |||
<version>3.16-beta2-SNAPSHOT</version> | |||
<version>3.16-beta1-SNAPSHOT</version> | |||
</parent> | |||
<artifactId>poi-scratchpad</artifactId> | |||
<packaging>jar</packaging> |
@@ -1,36 +0,0 @@ | |||
<?xml version="1.0" encoding="UTF-8"?> | |||
<classpath> | |||
<classpathentry kind="src" path="src/java"/> | |||
<classpathentry kind="src" path="src/testcases"/> | |||
<classpathentry kind="src" path="src/resources/main"/> | |||
<classpathentry kind="src" path="src/ooxml/java"/> | |||
<classpathentry kind="src" path="src/ooxml/testcases"/> | |||
<classpathentry kind="src" path="src/resources/ooxml"/> | |||
<classpathentry kind="src" path="src/scratchpad/src"/> | |||
<classpathentry kind="src" path="src/scratchpad/testcases"/> | |||
<classpathentry kind="src" path="src/resources/scratchpad"/> | |||
<classpathentry kind="src" path="src/contrib/poi-ruby/java"/> | |||
<classpathentry kind="src" path="src/examples/src"/> | |||
<classpathentry kind="src" path="src/excelant/java"/> | |||
<classpathentry kind="src" path="src/excelant/testcases"/> | |||
<classpathentry kind="src" path="src/excelant/resources"/> | |||
<classpathentry kind="src" path="src/integrationtest"/> | |||
<classpathentry kind="lib" path="lib/ant-1.9.4.jar"/> | |||
<classpathentry kind="lib" path="lib/ant-launcher-1.9.4.jar"/> | |||
<classpathentry kind="lib" path="lib/log4j-1.2.17.jar"/> | |||
<classpathentry exported="true" kind="lib" path="ooxml-lib/xmlbeans-2.6.0.jar"/> | |||
<classpathentry kind="lib" path="lib/hamcrest-core-1.3.jar"/> | |||
<classpathentry kind="lib" path="lib/junit-4.12.jar"/> | |||
<classpathentry kind="lib" path="ooxml-lib/curvesapi-1.04.jar"/> | |||
<classpathentry exported="true" kind="lib" path="ooxml-lib/ooxml-schemas-1.3.jar" sourcepath="ooxml-lib/ooxml-schemas-1.3-sources.jar"/> | |||
<classpathentry exported="true" kind="lib" path="ooxml-lib/ooxml-security-1.1.jar" sourcepath="ooxml-lib/ooxml-security-1.1-sources.jar"/> | |||
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6"/> | |||
<classpathentry exported="true" kind="lib" path="compile-lib/slf4j-api-1.7.12.jar"/> | |||
<classpathentry kind="lib" path="compile-lib/bcpkix-jdk15on-1.54.jar"/> | |||
<classpathentry kind="lib" path="compile-lib/bcprov-ext-jdk15on-1.54.jar"/> | |||
<classpathentry exported="true" kind="lib" path="compile-lib/xmlsec-2.0.6.jar"/> | |||
<classpathentry exported="true" kind="lib" path="lib/commons-codec-1.10.jar"/> | |||
<classpathentry exported="true" kind="lib" path="lib/commons-logging-1.2.jar"/> | |||
<classpathentry exported="true" kind="lib" path="lib/commons-collections4-4.1.jar"/> | |||
<classpathentry kind="output" path="build/eclipse"/> | |||
</classpath> |
@@ -1,18 +0,0 @@ | |||
<?xml version="1.0" encoding="UTF-8"?> | |||
<projectDescription> | |||
<name>ApachePOI</name> | |||
<comment></comment> | |||
<projects> | |||
</projects> | |||
<buildSpec> | |||
<buildCommand> | |||
<name>org.eclipse.jdt.core.javabuilder</name> | |||
<arguments> | |||
</arguments> | |||
</buildCommand> | |||
</buildSpec> | |||
<natures> | |||
<nature>org.sonar.ide.eclipse.core.sonarNature</nature> | |||
<nature>org.eclipse.jdt.core.javanature</nature> | |||
</natures> | |||
</projectDescription> |
@@ -1,2 +0,0 @@ | |||
eclipse.preferences.version=1 | |||
encoding/<project>=UTF-8 |
@@ -1,395 +0,0 @@ | |||
eclipse.preferences.version=1 | |||
org.eclipse.jdt.core.codeComplete.argumentPrefixes= | |||
org.eclipse.jdt.core.codeComplete.argumentSuffixes= | |||
org.eclipse.jdt.core.codeComplete.fieldPrefixes= | |||
org.eclipse.jdt.core.codeComplete.fieldSuffixes= | |||
org.eclipse.jdt.core.codeComplete.localPrefixes= | |||
org.eclipse.jdt.core.codeComplete.localSuffixes= | |||
org.eclipse.jdt.core.codeComplete.staticFieldPrefixes= | |||
org.eclipse.jdt.core.codeComplete.staticFieldSuffixes= | |||
org.eclipse.jdt.core.codeComplete.staticFinalFieldPrefixes= | |||
org.eclipse.jdt.core.codeComplete.staticFinalFieldSuffixes= | |||
org.eclipse.jdt.core.compiler.annotation.inheritNullAnnotations=disabled | |||
org.eclipse.jdt.core.compiler.annotation.missingNonNullByDefaultAnnotation=ignore | |||
org.eclipse.jdt.core.compiler.annotation.nonnull=org.eclipse.jdt.annotation.NonNull | |||
org.eclipse.jdt.core.compiler.annotation.nonnullbydefault=org.eclipse.jdt.annotation.NonNullByDefault | |||
org.eclipse.jdt.core.compiler.annotation.nullable=org.eclipse.jdt.annotation.Nullable | |||
org.eclipse.jdt.core.compiler.annotation.nullanalysis=disabled | |||
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled | |||
org.eclipse.jdt.core.compiler.codegen.methodParameters=do not generate | |||
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6 | |||
org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve | |||
org.eclipse.jdt.core.compiler.compliance=1.6 | |||
org.eclipse.jdt.core.compiler.debug.lineNumber=generate | |||
org.eclipse.jdt.core.compiler.debug.localVariable=generate | |||
org.eclipse.jdt.core.compiler.debug.sourceFile=generate | |||
org.eclipse.jdt.core.compiler.problem.annotationSuperInterface=warning | |||
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error | |||
org.eclipse.jdt.core.compiler.problem.autoboxing=ignore | |||
org.eclipse.jdt.core.compiler.problem.comparingIdentical=warning | |||
org.eclipse.jdt.core.compiler.problem.deadCode=warning | |||
org.eclipse.jdt.core.compiler.problem.deprecation=warning | |||
org.eclipse.jdt.core.compiler.problem.deprecationInDeprecatedCode=disabled | |||
org.eclipse.jdt.core.compiler.problem.deprecationWhenOverridingDeprecatedMethod=disabled | |||
org.eclipse.jdt.core.compiler.problem.discouragedReference=warning | |||
org.eclipse.jdt.core.compiler.problem.emptyStatement=ignore | |||
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error | |||
org.eclipse.jdt.core.compiler.problem.explicitlyClosedAutoCloseable=ignore | |||
org.eclipse.jdt.core.compiler.problem.fallthroughCase=ignore | |||
org.eclipse.jdt.core.compiler.problem.fatalOptionalError=disabled | |||
org.eclipse.jdt.core.compiler.problem.fieldHiding=ignore | |||
org.eclipse.jdt.core.compiler.problem.finalParameterBound=warning | |||
org.eclipse.jdt.core.compiler.problem.finallyBlockNotCompletingNormally=warning | |||
org.eclipse.jdt.core.compiler.problem.forbiddenReference=error | |||
org.eclipse.jdt.core.compiler.problem.hiddenCatchBlock=warning | |||
org.eclipse.jdt.core.compiler.problem.includeNullInfoFromAsserts=disabled | |||
org.eclipse.jdt.core.compiler.problem.incompatibleNonInheritedInterfaceMethod=warning | |||
org.eclipse.jdt.core.compiler.problem.incompleteEnumSwitch=warning | |||
org.eclipse.jdt.core.compiler.problem.indirectStaticAccess=ignore | |||
org.eclipse.jdt.core.compiler.problem.localVariableHiding=ignore | |||
org.eclipse.jdt.core.compiler.problem.methodWithConstructorName=warning | |||
org.eclipse.jdt.core.compiler.problem.missingDefaultCase=ignore | |||
org.eclipse.jdt.core.compiler.problem.missingDeprecatedAnnotation=ignore | |||
org.eclipse.jdt.core.compiler.problem.missingEnumCaseDespiteDefault=disabled | |||
org.eclipse.jdt.core.compiler.problem.missingHashCodeMethod=warning | |||
org.eclipse.jdt.core.compiler.problem.missingOverrideAnnotation=ignore | |||
org.eclipse.jdt.core.compiler.problem.missingOverrideAnnotationForInterfaceMethodImplementation=enabled | |||
org.eclipse.jdt.core.compiler.problem.missingSerialVersion=ignore | |||
org.eclipse.jdt.core.compiler.problem.missingSynchronizedOnInheritedMethod=ignore | |||
org.eclipse.jdt.core.compiler.problem.noEffectAssignment=warning | |||
org.eclipse.jdt.core.compiler.problem.noImplicitStringConversion=warning | |||
org.eclipse.jdt.core.compiler.problem.nonExternalizedStringLiteral=ignore | |||
org.eclipse.jdt.core.compiler.problem.nonnullParameterAnnotationDropped=warning | |||
org.eclipse.jdt.core.compiler.problem.nullAnnotationInferenceConflict=error | |||
org.eclipse.jdt.core.compiler.problem.nullReference=warning | |||
org.eclipse.jdt.core.compiler.problem.nullSpecViolation=error | |||
org.eclipse.jdt.core.compiler.problem.nullUncheckedConversion=warning | |||
org.eclipse.jdt.core.compiler.problem.overridingPackageDefaultMethod=warning | |||
org.eclipse.jdt.core.compiler.problem.parameterAssignment=ignore | |||
org.eclipse.jdt.core.compiler.problem.possibleAccidentalBooleanAssignment=ignore | |||
org.eclipse.jdt.core.compiler.problem.potentialNullReference=ignore | |||
org.eclipse.jdt.core.compiler.problem.potentiallyUnclosedCloseable=ignore | |||
org.eclipse.jdt.core.compiler.problem.rawTypeReference=warning | |||
org.eclipse.jdt.core.compiler.problem.redundantNullAnnotation=warning | |||
org.eclipse.jdt.core.compiler.problem.redundantNullCheck=ignore | |||
org.eclipse.jdt.core.compiler.problem.redundantSpecificationOfTypeArguments=ignore | |||
org.eclipse.jdt.core.compiler.problem.redundantSuperinterface=ignore | |||
org.eclipse.jdt.core.compiler.problem.reportMethodCanBePotentiallyStatic=ignore | |||
org.eclipse.jdt.core.compiler.problem.reportMethodCanBeStatic=ignore | |||
org.eclipse.jdt.core.compiler.problem.specialParameterHidingField=disabled | |||
org.eclipse.jdt.core.compiler.problem.staticAccessReceiver=warning | |||
org.eclipse.jdt.core.compiler.problem.suppressOptionalErrors=disabled | |||
org.eclipse.jdt.core.compiler.problem.suppressWarnings=enabled | |||
org.eclipse.jdt.core.compiler.problem.syntacticNullAnalysisForFields=disabled | |||
org.eclipse.jdt.core.compiler.problem.syntheticAccessEmulation=ignore | |||
org.eclipse.jdt.core.compiler.problem.typeParameterHiding=warning | |||
org.eclipse.jdt.core.compiler.problem.unavoidableGenericTypeProblems=enabled | |||
org.eclipse.jdt.core.compiler.problem.uncheckedTypeOperation=warning | |||
org.eclipse.jdt.core.compiler.problem.unclosedCloseable=warning | |||
org.eclipse.jdt.core.compiler.problem.undocumentedEmptyBlock=ignore | |||
org.eclipse.jdt.core.compiler.problem.unhandledWarningToken=ignore | |||
org.eclipse.jdt.core.compiler.problem.unnecessaryElse=ignore | |||
org.eclipse.jdt.core.compiler.problem.unnecessaryTypeCheck=warning | |||
org.eclipse.jdt.core.compiler.problem.unqualifiedFieldAccess=ignore | |||
org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownException=ignore | |||
org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionExemptExceptionAndThrowable=enabled | |||
org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionIncludeDocCommentReference=enabled | |||
org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionWhenOverriding=disabled | |||
org.eclipse.jdt.core.compiler.problem.unusedExceptionParameter=ignore | |||
org.eclipse.jdt.core.compiler.problem.unusedImport=warning | |||
org.eclipse.jdt.core.compiler.problem.unusedLabel=warning | |||
org.eclipse.jdt.core.compiler.problem.unusedLocal=warning | |||
org.eclipse.jdt.core.compiler.problem.unusedObjectAllocation=ignore | |||
org.eclipse.jdt.core.compiler.problem.unusedParameter=ignore | |||
org.eclipse.jdt.core.compiler.problem.unusedParameterIncludeDocCommentReference=enabled | |||
org.eclipse.jdt.core.compiler.problem.unusedParameterWhenImplementingAbstract=disabled | |||
org.eclipse.jdt.core.compiler.problem.unusedParameterWhenOverridingConcrete=disabled | |||
org.eclipse.jdt.core.compiler.problem.unusedPrivateMember=warning | |||
org.eclipse.jdt.core.compiler.problem.unusedTypeParameter=ignore | |||
org.eclipse.jdt.core.compiler.problem.unusedWarningToken=warning | |||
org.eclipse.jdt.core.compiler.problem.varargsArgumentNeedCast=warning | |||
org.eclipse.jdt.core.compiler.source=1.6 | |||
org.eclipse.jdt.core.formatter.align_type_members_on_columns=false | |||
org.eclipse.jdt.core.formatter.alignment_for_arguments_in_allocation_expression=16 | |||
org.eclipse.jdt.core.formatter.alignment_for_arguments_in_annotation=0 | |||
org.eclipse.jdt.core.formatter.alignment_for_arguments_in_enum_constant=16 | |||
org.eclipse.jdt.core.formatter.alignment_for_arguments_in_explicit_constructor_call=16 | |||
org.eclipse.jdt.core.formatter.alignment_for_arguments_in_method_invocation=16 | |||
org.eclipse.jdt.core.formatter.alignment_for_arguments_in_qualified_allocation_expression=16 | |||
org.eclipse.jdt.core.formatter.alignment_for_assignment=0 | |||
org.eclipse.jdt.core.formatter.alignment_for_binary_expression=16 | |||
org.eclipse.jdt.core.formatter.alignment_for_compact_if=16 | |||
org.eclipse.jdt.core.formatter.alignment_for_conditional_expression=80 | |||
org.eclipse.jdt.core.formatter.alignment_for_enum_constants=0 | |||
org.eclipse.jdt.core.formatter.alignment_for_expressions_in_array_initializer=16 | |||
org.eclipse.jdt.core.formatter.alignment_for_method_declaration=0 | |||
org.eclipse.jdt.core.formatter.alignment_for_multiple_fields=16 | |||
org.eclipse.jdt.core.formatter.alignment_for_parameters_in_constructor_declaration=16 | |||
org.eclipse.jdt.core.formatter.alignment_for_parameters_in_method_declaration=16 | |||
org.eclipse.jdt.core.formatter.alignment_for_resources_in_try=80 | |||
org.eclipse.jdt.core.formatter.alignment_for_selector_in_method_invocation=16 | |||
org.eclipse.jdt.core.formatter.alignment_for_superclass_in_type_declaration=16 | |||
org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_enum_declaration=16 | |||
org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_type_declaration=16 | |||
org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_constructor_declaration=16 | |||
org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_method_declaration=16 | |||
org.eclipse.jdt.core.formatter.alignment_for_union_type_in_multicatch=16 | |||
org.eclipse.jdt.core.formatter.blank_lines_after_imports=1 | |||
org.eclipse.jdt.core.formatter.blank_lines_after_package=1 | |||
org.eclipse.jdt.core.formatter.blank_lines_before_field=0 | |||
org.eclipse.jdt.core.formatter.blank_lines_before_first_class_body_declaration=0 | |||
org.eclipse.jdt.core.formatter.blank_lines_before_imports=1 | |||
org.eclipse.jdt.core.formatter.blank_lines_before_member_type=1 | |||
org.eclipse.jdt.core.formatter.blank_lines_before_method=1 | |||
org.eclipse.jdt.core.formatter.blank_lines_before_new_chunk=1 | |||
org.eclipse.jdt.core.formatter.blank_lines_before_package=0 | |||
org.eclipse.jdt.core.formatter.blank_lines_between_import_groups=1 | |||
org.eclipse.jdt.core.formatter.blank_lines_between_type_declarations=1 | |||
org.eclipse.jdt.core.formatter.brace_position_for_annotation_type_declaration=end_of_line | |||
org.eclipse.jdt.core.formatter.brace_position_for_anonymous_type_declaration=end_of_line | |||
org.eclipse.jdt.core.formatter.brace_position_for_array_initializer=end_of_line | |||
org.eclipse.jdt.core.formatter.brace_position_for_block=end_of_line | |||
org.eclipse.jdt.core.formatter.brace_position_for_block_in_case=end_of_line | |||
org.eclipse.jdt.core.formatter.brace_position_for_constructor_declaration=end_of_line | |||
org.eclipse.jdt.core.formatter.brace_position_for_enum_constant=end_of_line | |||
org.eclipse.jdt.core.formatter.brace_position_for_enum_declaration=end_of_line | |||
org.eclipse.jdt.core.formatter.brace_position_for_lambda_body=end_of_line | |||
org.eclipse.jdt.core.formatter.brace_position_for_method_declaration=end_of_line | |||
org.eclipse.jdt.core.formatter.brace_position_for_switch=end_of_line | |||
org.eclipse.jdt.core.formatter.brace_position_for_type_declaration=end_of_line | |||
org.eclipse.jdt.core.formatter.comment.clear_blank_lines_in_block_comment=false | |||
org.eclipse.jdt.core.formatter.comment.clear_blank_lines_in_javadoc_comment=false | |||
org.eclipse.jdt.core.formatter.comment.format_block_comments=true | |||
org.eclipse.jdt.core.formatter.comment.format_header=false | |||
org.eclipse.jdt.core.formatter.comment.format_html=true | |||
org.eclipse.jdt.core.formatter.comment.format_javadoc_comments=true | |||
org.eclipse.jdt.core.formatter.comment.format_line_comments=true | |||
org.eclipse.jdt.core.formatter.comment.format_source_code=true | |||
org.eclipse.jdt.core.formatter.comment.indent_parameter_description=true | |||
org.eclipse.jdt.core.formatter.comment.indent_root_tags=true | |||
org.eclipse.jdt.core.formatter.comment.insert_new_line_before_root_tags=insert | |||
org.eclipse.jdt.core.formatter.comment.insert_new_line_for_parameter=insert | |||
org.eclipse.jdt.core.formatter.comment.line_length=80 | |||
org.eclipse.jdt.core.formatter.comment.new_lines_at_block_boundaries=true | |||
org.eclipse.jdt.core.formatter.comment.new_lines_at_javadoc_boundaries=true | |||
org.eclipse.jdt.core.formatter.comment.preserve_white_space_between_code_and_line_comments=false | |||
org.eclipse.jdt.core.formatter.compact_else_if=true | |||
org.eclipse.jdt.core.formatter.continuation_indentation=2 | |||
org.eclipse.jdt.core.formatter.continuation_indentation_for_array_initializer=2 | |||
org.eclipse.jdt.core.formatter.disabling_tag=@formatter\:off | |||
org.eclipse.jdt.core.formatter.enabling_tag=@formatter\:on | |||
org.eclipse.jdt.core.formatter.format_guardian_clause_on_one_line=false | |||
org.eclipse.jdt.core.formatter.format_line_comment_starting_on_first_column=true | |||
org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_annotation_declaration_header=true | |||
org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_enum_constant_header=true | |||
org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_enum_declaration_header=true | |||
org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_type_header=true | |||
org.eclipse.jdt.core.formatter.indent_breaks_compare_to_cases=true | |||
org.eclipse.jdt.core.formatter.indent_empty_lines=false | |||
org.eclipse.jdt.core.formatter.indent_statements_compare_to_block=true | |||
org.eclipse.jdt.core.formatter.indent_statements_compare_to_body=true | |||
org.eclipse.jdt.core.formatter.indent_switchstatements_compare_to_cases=true | |||
org.eclipse.jdt.core.formatter.indent_switchstatements_compare_to_switch=false | |||
org.eclipse.jdt.core.formatter.indentation.size=4 | |||
org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_field=insert | |||
org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_local_variable=insert | |||
org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_method=insert | |||
org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_package=insert | |||
org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_parameter=do not insert | |||
org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_type=insert | |||
org.eclipse.jdt.core.formatter.insert_new_line_after_label=do not insert | |||
org.eclipse.jdt.core.formatter.insert_new_line_after_opening_brace_in_array_initializer=do not insert | |||
org.eclipse.jdt.core.formatter.insert_new_line_after_type_annotation=do not insert | |||
org.eclipse.jdt.core.formatter.insert_new_line_at_end_of_file_if_missing=do not insert | |||
org.eclipse.jdt.core.formatter.insert_new_line_before_catch_in_try_statement=do not insert | |||
org.eclipse.jdt.core.formatter.insert_new_line_before_closing_brace_in_array_initializer=do not insert | |||
org.eclipse.jdt.core.formatter.insert_new_line_before_else_in_if_statement=do not insert | |||
org.eclipse.jdt.core.formatter.insert_new_line_before_finally_in_try_statement=do not insert | |||
org.eclipse.jdt.core.formatter.insert_new_line_before_while_in_do_statement=do not insert | |||
org.eclipse.jdt.core.formatter.insert_new_line_in_empty_annotation_declaration=insert | |||
org.eclipse.jdt.core.formatter.insert_new_line_in_empty_anonymous_type_declaration=insert | |||
org.eclipse.jdt.core.formatter.insert_new_line_in_empty_block=insert | |||
org.eclipse.jdt.core.formatter.insert_new_line_in_empty_enum_constant=insert | |||
org.eclipse.jdt.core.formatter.insert_new_line_in_empty_enum_declaration=insert | |||
org.eclipse.jdt.core.formatter.insert_new_line_in_empty_method_body=insert | |||
org.eclipse.jdt.core.formatter.insert_new_line_in_empty_type_declaration=insert | |||
org.eclipse.jdt.core.formatter.insert_space_after_and_in_type_parameter=insert | |||
org.eclipse.jdt.core.formatter.insert_space_after_assignment_operator=insert | |||
org.eclipse.jdt.core.formatter.insert_space_after_at_in_annotation=do not insert | |||
org.eclipse.jdt.core.formatter.insert_space_after_at_in_annotation_type_declaration=do not insert | |||
org.eclipse.jdt.core.formatter.insert_space_after_binary_operator=insert | |||
org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_arguments=insert | |||
org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_parameters=insert | |||
org.eclipse.jdt.core.formatter.insert_space_after_closing_brace_in_block=insert | |||
org.eclipse.jdt.core.formatter.insert_space_after_closing_paren_in_cast=insert | |||
org.eclipse.jdt.core.formatter.insert_space_after_colon_in_assert=insert | |||
org.eclipse.jdt.core.formatter.insert_space_after_colon_in_case=insert | |||
org.eclipse.jdt.core.formatter.insert_space_after_colon_in_conditional=insert | |||
org.eclipse.jdt.core.formatter.insert_space_after_colon_in_for=insert | |||
org.eclipse.jdt.core.formatter.insert_space_after_colon_in_labeled_statement=insert | |||
org.eclipse.jdt.core.formatter.insert_space_after_comma_in_allocation_expression=insert | |||
org.eclipse.jdt.core.formatter.insert_space_after_comma_in_annotation=insert | |||
org.eclipse.jdt.core.formatter.insert_space_after_comma_in_array_initializer=insert | |||
org.eclipse.jdt.core.formatter.insert_space_after_comma_in_constructor_declaration_parameters=insert | |||
org.eclipse.jdt.core.formatter.insert_space_after_comma_in_constructor_declaration_throws=insert | |||
org.eclipse.jdt.core.formatter.insert_space_after_comma_in_enum_constant_arguments=insert | |||
org.eclipse.jdt.core.formatter.insert_space_after_comma_in_enum_declarations=insert | |||
org.eclipse.jdt.core.formatter.insert_space_after_comma_in_explicitconstructorcall_arguments=insert | |||
org.eclipse.jdt.core.formatter.insert_space_after_comma_in_for_increments=insert | |||
org.eclipse.jdt.core.formatter.insert_space_after_comma_in_for_inits=insert | |||
org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_declaration_parameters=insert | |||
org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_declaration_throws=insert | |||
org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_invocation_arguments=insert | |||
org.eclipse.jdt.core.formatter.insert_space_after_comma_in_multiple_field_declarations=insert | |||
org.eclipse.jdt.core.formatter.insert_space_after_comma_in_multiple_local_declarations=insert | |||
org.eclipse.jdt.core.formatter.insert_space_after_comma_in_parameterized_type_reference=insert | |||
org.eclipse.jdt.core.formatter.insert_space_after_comma_in_superinterfaces=insert | |||
org.eclipse.jdt.core.formatter.insert_space_after_comma_in_type_arguments=insert | |||
org.eclipse.jdt.core.formatter.insert_space_after_comma_in_type_parameters=insert | |||
org.eclipse.jdt.core.formatter.insert_space_after_ellipsis=insert | |||
org.eclipse.jdt.core.formatter.insert_space_after_lambda_arrow=insert | |||
org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_parameterized_type_reference=do not insert | |||
org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_type_arguments=do not insert | |||
org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_type_parameters=do not insert | |||
org.eclipse.jdt.core.formatter.insert_space_after_opening_brace_in_array_initializer=insert | |||
org.eclipse.jdt.core.formatter.insert_space_after_opening_bracket_in_array_allocation_expression=do not insert | |||
org.eclipse.jdt.core.formatter.insert_space_after_opening_bracket_in_array_reference=do not insert | |||
org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_annotation=do not insert | |||
org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_cast=do not insert | |||
org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_catch=do not insert | |||
org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_constructor_declaration=do not insert | |||
org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_enum_constant=do not insert | |||
org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_for=do not insert | |||
org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_if=do not insert | |||
org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_method_declaration=do not insert | |||
org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_method_invocation=do not insert | |||
org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_parenthesized_expression=do not insert | |||
org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_switch=do not insert | |||
org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_synchronized=do not insert | |||
org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_try=do not insert | |||
org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_while=do not insert | |||
org.eclipse.jdt.core.formatter.insert_space_after_postfix_operator=do not insert | |||
org.eclipse.jdt.core.formatter.insert_space_after_prefix_operator=do not insert | |||
org.eclipse.jdt.core.formatter.insert_space_after_question_in_conditional=insert | |||
org.eclipse.jdt.core.formatter.insert_space_after_question_in_wildcard=do not insert | |||
org.eclipse.jdt.core.formatter.insert_space_after_semicolon_in_for=insert | |||
org.eclipse.jdt.core.formatter.insert_space_after_semicolon_in_try_resources=insert | |||
org.eclipse.jdt.core.formatter.insert_space_after_unary_operator=do not insert | |||
org.eclipse.jdt.core.formatter.insert_space_before_and_in_type_parameter=insert | |||
org.eclipse.jdt.core.formatter.insert_space_before_assignment_operator=insert | |||
org.eclipse.jdt.core.formatter.insert_space_before_at_in_annotation_type_declaration=insert | |||
org.eclipse.jdt.core.formatter.insert_space_before_binary_operator=insert | |||
org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_parameterized_type_reference=do not insert | |||
org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_type_arguments=do not insert | |||
org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_type_parameters=do not insert | |||
org.eclipse.jdt.core.formatter.insert_space_before_closing_brace_in_array_initializer=insert | |||
org.eclipse.jdt.core.formatter.insert_space_before_closing_bracket_in_array_allocation_expression=do not insert | |||
org.eclipse.jdt.core.formatter.insert_space_before_closing_bracket_in_array_reference=do not insert | |||
org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_annotation=do not insert | |||
org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_cast=do not insert | |||
org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_catch=do not insert | |||
org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_constructor_declaration=do not insert | |||
org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_enum_constant=do not insert | |||
org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_for=do not insert | |||
org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_if=do not insert | |||
org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_method_declaration=do not insert | |||
org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_method_invocation=do not insert | |||
org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_parenthesized_expression=do not insert | |||
org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_switch=do not insert | |||
org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_synchronized=do not insert | |||
org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_try=do not insert | |||
org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_while=do not insert | |||
org.eclipse.jdt.core.formatter.insert_space_before_colon_in_assert=insert | |||
org.eclipse.jdt.core.formatter.insert_space_before_colon_in_case=do not insert | |||
org.eclipse.jdt.core.formatter.insert_space_before_colon_in_conditional=insert | |||
org.eclipse.jdt.core.formatter.insert_space_before_colon_in_default=do not insert | |||
org.eclipse.jdt.core.formatter.insert_space_before_colon_in_for=insert | |||
org.eclipse.jdt.core.formatter.insert_space_before_colon_in_labeled_statement=do not insert | |||
org.eclipse.jdt.core.formatter.insert_space_before_comma_in_allocation_expression=do not insert | |||
org.eclipse.jdt.core.formatter.insert_space_before_comma_in_annotation=do not insert | |||
org.eclipse.jdt.core.formatter.insert_space_before_comma_in_array_initializer=do not insert | |||
org.eclipse.jdt.core.formatter.insert_space_before_comma_in_constructor_declaration_parameters=do not insert | |||
org.eclipse.jdt.core.formatter.insert_space_before_comma_in_constructor_declaration_throws=do not insert | |||
org.eclipse.jdt.core.formatter.insert_space_before_comma_in_enum_constant_arguments=do not insert | |||
org.eclipse.jdt.core.formatter.insert_space_before_comma_in_enum_declarations=do not insert | |||
org.eclipse.jdt.core.formatter.insert_space_before_comma_in_explicitconstructorcall_arguments=do not insert | |||
org.eclipse.jdt.core.formatter.insert_space_before_comma_in_for_increments=do not insert | |||
org.eclipse.jdt.core.formatter.insert_space_before_comma_in_for_inits=do not insert | |||
org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_declaration_parameters=do not insert | |||
org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_declaration_throws=do not insert | |||
org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_invocation_arguments=do not insert | |||
org.eclipse.jdt.core.formatter.insert_space_before_comma_in_multiple_field_declarations=do not insert | |||
org.eclipse.jdt.core.formatter.insert_space_before_comma_in_multiple_local_declarations=do not insert | |||
org.eclipse.jdt.core.formatter.insert_space_before_comma_in_parameterized_type_reference=do not insert | |||
org.eclipse.jdt.core.formatter.insert_space_before_comma_in_superinterfaces=do not insert | |||
org.eclipse.jdt.core.formatter.insert_space_before_comma_in_type_arguments=do not insert | |||
org.eclipse.jdt.core.formatter.insert_space_before_comma_in_type_parameters=do not insert | |||
org.eclipse.jdt.core.formatter.insert_space_before_ellipsis=do not insert | |||
org.eclipse.jdt.core.formatter.insert_space_before_lambda_arrow=insert | |||
org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_parameterized_type_reference=do not insert | |||
org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_type_arguments=do not insert | |||
org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_type_parameters=do not insert | |||
org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_annotation_type_declaration=insert | |||
org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_anonymous_type_declaration=insert | |||
org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_array_initializer=insert | |||
org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_block=insert | |||
org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_constructor_declaration=insert | |||
org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_enum_constant=insert | |||
org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_enum_declaration=insert | |||
org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_method_declaration=insert | |||
org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_switch=insert | |||
org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_type_declaration=insert | |||
org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_allocation_expression=do not insert | |||
org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_reference=do not insert | |||
org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_type_reference=do not insert | |||
org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_annotation=do not insert | |||
org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_annotation_type_member_declaration=do not insert | |||
org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_catch=insert | |||
org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_constructor_declaration=do not insert | |||
org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_enum_constant=do not insert | |||
org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_for=insert | |||
org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_if=insert | |||
org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_method_declaration=do not insert | |||
org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_method_invocation=do not insert | |||
org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_parenthesized_expression=do not insert | |||
org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_switch=insert | |||
org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_synchronized=insert | |||
org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_try=insert | |||
org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_while=insert | |||
org.eclipse.jdt.core.formatter.insert_space_before_parenthesized_expression_in_return=insert | |||
org.eclipse.jdt.core.formatter.insert_space_before_parenthesized_expression_in_throw=insert | |||
org.eclipse.jdt.core.formatter.insert_space_before_postfix_operator=do not insert | |||
org.eclipse.jdt.core.formatter.insert_space_before_prefix_operator=do not insert | |||
org.eclipse.jdt.core.formatter.insert_space_before_question_in_conditional=insert | |||
org.eclipse.jdt.core.formatter.insert_space_before_question_in_wildcard=do not insert | |||
org.eclipse.jdt.core.formatter.insert_space_before_semicolon=do not insert | |||
org.eclipse.jdt.core.formatter.insert_space_before_semicolon_in_for=do not insert | |||
org.eclipse.jdt.core.formatter.insert_space_before_semicolon_in_try_resources=do not insert | |||
org.eclipse.jdt.core.formatter.insert_space_before_unary_operator=do not insert | |||
org.eclipse.jdt.core.formatter.insert_space_between_brackets_in_array_type_reference=do not insert | |||
org.eclipse.jdt.core.formatter.insert_space_between_empty_braces_in_array_initializer=do not insert | |||
org.eclipse.jdt.core.formatter.insert_space_between_empty_brackets_in_array_allocation_expression=do not insert | |||
org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_annotation_type_member_declaration=do not insert | |||
org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_constructor_declaration=do not insert | |||
org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_enum_constant=do not insert | |||
org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_method_declaration=do not insert | |||
org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_method_invocation=do not insert | |||
org.eclipse.jdt.core.formatter.join_lines_in_comments=true | |||
org.eclipse.jdt.core.formatter.join_wrapped_lines=true | |||
org.eclipse.jdt.core.formatter.keep_else_statement_on_same_line=false | |||
org.eclipse.jdt.core.formatter.keep_empty_array_initializer_on_one_line=false | |||
org.eclipse.jdt.core.formatter.keep_imple_if_on_one_line=false | |||
org.eclipse.jdt.core.formatter.keep_then_statement_on_same_line=false | |||
org.eclipse.jdt.core.formatter.lineSplit=80 | |||
org.eclipse.jdt.core.formatter.never_indent_block_comments_on_first_column=false | |||
org.eclipse.jdt.core.formatter.never_indent_line_comments_on_first_column=false | |||
org.eclipse.jdt.core.formatter.number_of_blank_lines_at_beginning_of_method_body=0 | |||
org.eclipse.jdt.core.formatter.number_of_empty_lines_to_preserve=1 | |||
org.eclipse.jdt.core.formatter.put_empty_statement_on_new_line=true | |||
org.eclipse.jdt.core.formatter.tabulation.char=space | |||
org.eclipse.jdt.core.formatter.tabulation.size=4 | |||
org.eclipse.jdt.core.formatter.use_on_off_tags=false | |||
org.eclipse.jdt.core.formatter.use_tabs_only_for_leading_indentations=false | |||
org.eclipse.jdt.core.formatter.wrap_before_binary_operator=true | |||
org.eclipse.jdt.core.formatter.wrap_before_or_operator_multicatch=true | |||
org.eclipse.jdt.core.formatter.wrap_outer_expressions_when_nested=true |
@@ -1,4 +0,0 @@ | |||
eclipse.preferences.version=1 | |||
org.moreunit.core.anyLanguage.srcFolderPathTemplate=${srcProject} | |||
org.moreunit.core.anyLanguage.testFileNameTemplate=${srcFile}Test | |||
org.moreunit.core.anyLanguage.testFolderPathTemplate=${srcProject} |
@@ -1,4 +0,0 @@ | |||
eclipse.preferences.version=1 | |||
org.moreunit.preferences.version=2 | |||
org.moreunit.unitsourcefolder=ApachePOI\:src/java\:ApachePOI\:src/testcases\#ApachePOI\:src/java\:ApachePOI\:src/ooxml/testcases\#ApachePOI\:src/java\:ApachePOI\:src/scratchpad/testcases\#ApachePOI\:src/java\:ApachePOI\:src/excelant/testcases\#ApachePOI\:src/java\:ApachePOI\:src/integrationtest | |||
org.moreunit.useprojectsettings=true |
@@ -1,294 +0,0 @@ | |||
/* ==================================================================== | |||
Licensed to the Apache Software Foundation (ASF) under one or more | |||
contributor license agreements. See the NOTICE file distributed with | |||
this work for additional information regarding copyright ownership. | |||
The ASF licenses this file to You under the Apache License, Version 2.0 | |||
(the "License"); you may not use this file except in compliance with | |||
the License. You may obtain a copy of the License at | |||
http://www.apache.org/licenses/LICENSE-2.0 | |||
Unless required by applicable law or agreed to in writing, software | |||
distributed under the License is distributed on an "AS IS" BASIS, | |||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | |||
See the License for the specific language governing permissions and | |||
limitations under the License. | |||
==================================================================== */ | |||
buildscript { | |||
repositories { | |||
maven { url "https://plugins.gradle.org/m2/" } | |||
} | |||
dependencies { | |||
classpath 'me.champeau.gradle:japicmp-gradle-plugin:0.1.2' | |||
} | |||
} | |||
// For help converting an Ant build to a Gradle build, see | |||
// https://docs.gradle.org/current/userguide/ant.html | |||
ant.importBuild 'build.xml' | |||
/** | |||
Define properties for all projects, including this one | |||
*/ | |||
allprojects { | |||
apply plugin: 'eclipse' | |||
task wrapper(type: Wrapper) { | |||
gradleVersion = '2.14.1' | |||
} | |||
task adjustWrapperPropertiesFile << { | |||
ant.replaceregexp(match:'^#.*', replace:'', flags:'g', byline:true) { | |||
fileset(dir: project.projectDir, includes: 'gradle/wrapper/gradle-wrapper.properties') | |||
} | |||
new File(project.projectDir, 'gradle/wrapper/gradle-wrapper.properties').with { it.text = it.readLines().findAll { it }.sort().join('\n') } | |||
ant.fixcrlf(file: 'gradle/wrapper/gradle-wrapper.properties', eol: 'lf') | |||
} | |||
wrapper.finalizedBy adjustWrapperPropertiesFile | |||
} | |||
/** | |||
Define things that are only necessary in sub-projects, but not in the master-project itself | |||
*/ | |||
subprojects { | |||
//Put instructions for each sub project, but not the master | |||
apply plugin: 'java' | |||
apply plugin: 'jacoco' | |||
// See https://github.com/melix/japicmp-gradle-plugin | |||
apply plugin: 'me.champeau.gradle.japicmp' | |||
version = '3.16-beta1' | |||
ext { | |||
japicmpversion = '3.15' | |||
} | |||
tasks.withType(JavaCompile) { | |||
options.encoding = 'UTF-8' | |||
} | |||
sourceCompatibility = 1.6 | |||
repositories { | |||
mavenCentral() | |||
} | |||
jar { | |||
manifest { | |||
attributes 'Implementation-Title': 'Apache POI', 'Implementation-Version': version | |||
} | |||
} | |||
test { | |||
// Exclude some tests that are not actually tests or do not run cleanly on purpose | |||
exclude '**/BaseTestBorderStyle.class' | |||
exclude '**/BaseTestCellUtil.class' | |||
exclude '**/TestUnfixedBugs.class' | |||
exclude '**/TestOneFile.class' | |||
systemProperties = System.properties | |||
// set heap size for the test JVM(s) | |||
minHeapSize = "128m" | |||
maxHeapSize = "768m" | |||
// show standard out and standard error of the test JVM(s) on the console | |||
//testLogging.showStandardStreams = true | |||
// http://forums.gradle.org/gradle/topics/jacoco_related_failure_in_multiproject_build | |||
systemProperties['user.dir'] = workingDir | |||
systemProperties['POI.testdata.path'] = '../../test-data' | |||
//systemProperties['user.language'] = 'en' | |||
//systemProperties['user.country'] = 'US' | |||
} | |||
test.beforeSuite { TestDescriptor suite -> | |||
System.setProperty('user.language', 'en') | |||
System.setProperty('user.country', 'US') | |||
} | |||
jacoco { | |||
toolVersion = '0.7.7.201606060606' | |||
} | |||
// ensure the build-dir exists | |||
projectDir.mkdirs() | |||
} | |||
project('main') { | |||
sourceSets.main.java.srcDirs = ['../../src/java'] | |||
sourceSets.main.resources.srcDirs = ['../../src/resources/main'] | |||
sourceSets.test.java.srcDirs = ['../../src/testcases'] | |||
dependencies { | |||
compile 'commons-codec:commons-codec:1.10' | |||
compile 'commons-logging:commons-logging:1.2' | |||
testCompile 'junit:junit:4.12' | |||
} | |||
// Create a separate jar for test-code to depend on it in other projects | |||
// See http://stackoverflow.com/questions/5144325/gradle-test-dependency | |||
task testJar(type: Jar, dependsOn: testClasses) { | |||
baseName = "test-${project.archivesBaseName}" | |||
from sourceSets.test.output | |||
} | |||
configurations { | |||
tests | |||
} | |||
artifacts { | |||
tests testJar | |||
} | |||
// TOOD: we should not duplicate this task in each project, but I did not figure out how to inject the artifactId for each project | |||
task japicmp(type: me.champeau.gradle.ArtifactJapicmpTask, dependsOn: jar) { | |||
baseline = 'org.apache.poi:poi:' + japicmpversion + '@jar' | |||
to = jar.archivePath | |||
onlyModified = true | |||
onlyBinaryIncompatibleModified = true | |||
failOnModification = false | |||
txtOutputFile = file("$buildDir/reports/japi.txt") | |||
htmlOutputFile = file("$buildDir/reports/japi.html") | |||
} | |||
} | |||
project('ooxml') { | |||
sourceSets.main.java.srcDirs = ['../../src/ooxml/java'] | |||
sourceSets.main.resources.srcDirs = ['../../src/ooxml/resources', '../../src/resources/ooxml'] | |||
sourceSets.test.java.srcDirs = ['../../src/ooxml/testcases'] | |||
// for now import the ant-task for building the jars from build.xml | |||
// we need to rename the tasks as e.g. task "jar" conflicts with :ooxml:jar | |||
ant.importBuild('../../build.xml') { antTargetName -> | |||
'ant-' + antTargetName | |||
} | |||
compileJava.dependsOn 'ant-compile-ooxml-xsds' | |||
dependencies { | |||
compile 'org.apache.xmlbeans:xmlbeans:2.6.0' | |||
compile 'org.apache.commons:commons-collections4:4.1' | |||
compile 'org.apache.santuario:xmlsec:2.0.6' | |||
compile 'org.bouncycastle:bcpkix-jdk15on:1.54' | |||
compile 'com.github.virtuald:curvesapi:1.04' | |||
// for ooxml-lite, should we move this somewhere else? | |||
compile 'junit:junit:4.12' | |||
compile project(':main') | |||
compile project(':scratchpad') // TODO: get rid of this dependency! | |||
compile files('../../ooxml-lib/ooxml-schemas-1.3.jar') | |||
compile files('../../ooxml-lib/ooxml-security-1.1.jar') | |||
testCompile 'junit:junit:4.12' | |||
testCompile project(path: ':main', configuration: 'tests') | |||
} | |||
// TOOD: we should not duplicate this task in each project, but I did not figure out how to inject the artifactId for each project | |||
task japicmp(type: me.champeau.gradle.ArtifactJapicmpTask, dependsOn: jar) { | |||
baseline = 'org.apache.poi:poi-ooxml:' + japicmpversion + '@jar' | |||
to = jar.archivePath | |||
onlyModified = true | |||
onlyBinaryIncompatibleModified = true | |||
failOnModification = false | |||
txtOutputFile = file("$buildDir/reports/japi.txt") | |||
htmlOutputFile = file("$buildDir/reports/japi.html") | |||
} | |||
} | |||
project('examples') { | |||
sourceSets.main.java.srcDirs = ['../../src/examples/src'] | |||
dependencies { | |||
compile project(':main') | |||
compile project(':ooxml') | |||
} | |||
} | |||
project('excelant') { | |||
sourceSets.main.java.srcDirs = ['../../src/excelant/java'] | |||
sourceSets.main.resources.srcDirs = ['../../src/excelant/resources'] | |||
sourceSets.test.java.srcDirs = ['../../src/excelant/testcases'] | |||
dependencies { | |||
compile 'org.apache.ant:ant:1.9.4' | |||
compile project(':main') | |||
compile project(':ooxml') | |||
testCompile project(path: ':main', configuration: 'tests') | |||
} | |||
// TOOD: we should not duplicate this task in each project, but I did not figure out how to inject the artifactId for each project | |||
task japicmp(type: me.champeau.gradle.ArtifactJapicmpTask, dependsOn: jar) { | |||
baseline = 'org.apache.poi:poi-excelant:' + japicmpversion + '@jar' | |||
to = jar.archivePath | |||
onlyModified = true | |||
onlyBinaryIncompatibleModified = true | |||
failOnModification = false | |||
txtOutputFile = file("$buildDir/reports/japi.txt") | |||
htmlOutputFile = file("$buildDir/reports/japi.html") | |||
} | |||
} | |||
project('integrationtest') { | |||
sourceSets.test.java.srcDirs = ['../../src/integrationtest'] | |||
dependencies { | |||
compile 'org.apache.ant:ant:1.9.4' | |||
compile project(':main') | |||
compile project(':ooxml') | |||
compile project(':scratchpad') | |||
compile project(':examples') | |||
testCompile 'junit:junit:4.12' | |||
} | |||
test { | |||
// exclude these from the normal test-run | |||
exclude '**/TestAllFiles.class' | |||
exclude '**/*FileHandler.class' | |||
exclude '**/RecordsStresser.class' | |||
} | |||
task integrationTest(type: Test) { | |||
// these are just tests used during development of more test-code | |||
exclude '**/*FileHandler.class' | |||
exclude '**/RecordStresser.class' | |||
} | |||
} | |||
project('scratchpad') { | |||
sourceSets.main.java.srcDirs = ['../../src/scratchpad/src'] | |||
sourceSets.main.resources.srcDirs = ['../../src/resources/scratchpad'] | |||
sourceSets.test.java.srcDirs = ['../../src/scratchpad/testcases'] | |||
dependencies { | |||
compile project(':main') | |||
// cyclic-dependency here: compile project(':ooxml') | |||
testCompile 'junit:junit:4.12' | |||
testCompile project(path: ':main', configuration: 'tests') | |||
} | |||
// TOOD: we should not duplicate this task in each project, but I did not figure out how to inject the artifactId for each project | |||
task japicmp(type: me.champeau.gradle.ArtifactJapicmpTask, dependsOn: jar) { | |||
baseline = 'org.apache.poi:poi-scratchpad:' + japicmpversion + '@jar' | |||
to = jar.archivePath | |||
onlyModified = true | |||
onlyBinaryIncompatibleModified = true | |||
failOnModification = false | |||
txtOutputFile = file("$buildDir/reports/japi.txt") | |||
htmlOutputFile = file("$buildDir/reports/japi.html") | |||
} | |||
} |
@@ -1,142 +0,0 @@ | |||
<?xml version="1.0"?> | |||
<?xml-stylesheet type="text/xsl"?> | |||
<rdf:RDF xml:lang="en" | |||
xmlns="http://usefulinc.com/ns/doap#" | |||
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" | |||
xmlns:asfext="http://projects.apache.org/ns/asfext#" | |||
xmlns:foaf="http://xmlns.com/foaf/0.1/"> | |||
<!-- | |||
Licensed to the Apache Software Foundation (ASF) under one or more | |||
contributor license agreements. See the NOTICE file distributed with | |||
this work for additional information regarding copyright ownership. | |||
The ASF licenses this file to You under the Apache License, Version 2.0 | |||
(the "License"); you may not use this file except in compliance with | |||
the License. You may obtain a copy of the License at | |||
http://www.apache.org/licenses/LICENSE-2.0 | |||
Unless required by applicable law or agreed to in writing, software | |||
distributed under the License is distributed on an "AS IS" BASIS, | |||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | |||
See the License for the specific language governing permissions and | |||
limitations under the License. | |||
--> | |||
<Project rdf:about="http://poi.apache.org"> | |||
<created>2006-01-26</created> | |||
<license rdf:resource="http://spdx.org/licenses/Apache-2.0" /> | |||
<name>Apache POI</name> | |||
<homepage rdf:resource="http://poi.apache.org" /> | |||
<asfext:pmc rdf:resource="http://poi.apache.org" /> | |||
<shortdesc>Java API To Access Microsoft Document File Formats</shortdesc> | |||
<description>APIs for manipulating various file formats based upon Open Office XML (ECMA-376) and Microsoft's OLE 2 Compound Document formats using pure Java. Apache POI is your Java Excel, Word and PowerPoint solution. We have a complete API for porting other OOXML and OLE 2 Compound Document formats and welcome others to participate.</description> | |||
<bug-database rdf:resource="http://issues.apache.org/bugzilla/buglist.cgi?product=POI" /> | |||
<mailing-list rdf:resource="http://poi.apache.org/mailinglists.html" /> | |||
<download-page rdf:resource="http://www.apache.org/dyn/closer.lua/poi/" /> | |||
<programming-language>Java</programming-language> | |||
<category rdf:resource="http://projects.apache.org/category/content" /> | |||
<category rdf:resource="http://projects.apache.org/category/library" /> | |||
<release> | |||
<Version> | |||
<name>Apache POI 3.15</name> | |||
<created>2016-09-21</created> | |||
<revision>3.15</revision> | |||
</Version> | |||
</release> | |||
<release> | |||
<Version> | |||
<name>Apache POI 3.14</name> | |||
<created>2016-03-05</created> | |||
<revision>3.14</revision> | |||
</Version> | |||
</release> | |||
<release> | |||
<Version> | |||
<name>Apache POI 3.13</name> | |||
<created>2015-09-29</created> | |||
<revision>3.13</revision> | |||
</Version> | |||
</release> | |||
<release> | |||
<Version> | |||
<name>Apache POI 3.12</name> | |||
<created>2015-05-11</created> | |||
<revision>3.12</revision> | |||
</Version> | |||
</release> | |||
<release> | |||
<Version> | |||
<name>Apache POI 3.11</name> | |||
<created>2014-12-21</created> | |||
<revision>3.11</revision> | |||
</Version> | |||
</release> | |||
<release> | |||
<Version> | |||
<name>Apache POI 3.10.1</name> | |||
<created>2014-08-18</created> | |||
<revision>3.10.1</revision> | |||
</Version> | |||
</release> | |||
<release> | |||
<Version> | |||
<name>Apache POI 3.10</name> | |||
<created>2014-02-08</created> | |||
<revision>3.10</revision> | |||
</Version> | |||
</release> | |||
<release> | |||
<Version> | |||
<name>Apache POI 3.9</name> | |||
<created>2012-12-03</created> | |||
<revision>3.9</revision> | |||
</Version> | |||
</release> | |||
<release> | |||
<Version> | |||
<name>Apache POI 3.8</name> | |||
<created>2012-03-26</created> | |||
<revision>3.8</revision> | |||
</Version> | |||
</release> | |||
<release> | |||
<Version> | |||
<name>Apache POI 3.7</name> | |||
<created>2010-10-29</created> | |||
<revision>3.7</revision> | |||
</Version> | |||
</release> | |||
<release> | |||
<Version> | |||
<name>Apache POI 3.6</name> | |||
<created>2009-12-14</created> | |||
<revision>3.6</revision> | |||
</Version> | |||
</release> | |||
<release> | |||
<Version> | |||
<name>Apache POI 3.5</name> | |||
<created>2009-09-28</created> | |||
<revision>3.5</revision> | |||
</Version> | |||
</release> | |||
<release> | |||
<Version> | |||
<name>Apache POI 3.2</name> | |||
<created>2008-10-19</created> | |||
<revision>3.2</revision> | |||
</Version> | |||
</release> | |||
<repository> | |||
<SVNRepository> | |||
<location rdf:resource="http://svn.apache.org/repos/asf/poi/"/> | |||
<browse rdf:resource="http://svn.apache.org/viewvc/poi/"/> | |||
</SVNRepository> | |||
</repository> | |||
<maintainer> | |||
<foaf:Person> | |||
<foaf:name>POI Committers</foaf:name> | |||
<foaf:mbox rdf:resource="mailto:dev@poi.apache.org"/> | |||
</foaf:Person> | |||
</maintainer> | |||
</Project> | |||
</rdf:RDF> |
@@ -1,513 +0,0 @@ | |||
Apache License | |||
Version 2.0, January 2004 | |||
http://www.apache.org/licenses/ | |||
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION | |||
1. Definitions. | |||
"License" shall mean the terms and conditions for use, reproduction, | |||
and distribution as defined by Sections 1 through 9 of this document. | |||
"Licensor" shall mean the copyright owner or entity authorized by | |||
the copyright owner that is granting the License. | |||
"Legal Entity" shall mean the union of the acting entity and all | |||
other entities that control, are controlled by, or are under common | |||
control with that entity. For the purposes of this definition, | |||
"control" means (i) the power, direct or indirect, to cause the | |||
direction or management of such entity, whether by contract or | |||
otherwise, or (ii) ownership of fifty percent (50%) or more of the | |||
outstanding shares, or (iii) beneficial ownership of such entity. | |||
"You" (or "Your") shall mean an individual or Legal Entity | |||
exercising permissions granted by this License. | |||
"Source" form shall mean the preferred form for making modifications, | |||
including but not limited to software source code, documentation | |||
source, and configuration files. | |||
"Object" form shall mean any form resulting from mechanical | |||
transformation or translation of a Source form, including but | |||
not limited to compiled object code, generated documentation, | |||
and conversions to other media types. | |||
"Work" shall mean the work of authorship, whether in Source or | |||
Object form, made available under the License, as indicated by a | |||
copyright notice that is included in or attached to the work | |||
(an example is provided in the Appendix below). | |||
"Derivative Works" shall mean any work, whether in Source or Object | |||
form, that is based on (or derived from) the Work and for which the | |||
editorial revisions, annotations, elaborations, or other modifications | |||
represent, as a whole, an original work of authorship. For the purposes | |||
of this License, Derivative Works shall not include works that remain | |||
separable from, or merely link (or bind by name) to the interfaces of, | |||
the Work and Derivative Works thereof. | |||
"Contribution" shall mean any work of authorship, including | |||
the original version of the Work and any modifications or additions | |||
to that Work or Derivative Works thereof, that is intentionally | |||
submitted to Licensor for inclusion in the Work by the copyright owner | |||
or by an individual or Legal Entity authorized to submit on behalf of | |||
the copyright owner. For the purposes of this definition, "submitted" | |||
means any form of electronic, verbal, or written communication sent | |||
to the Licensor or its representatives, including but not limited to | |||
communication on electronic mailing lists, source code control systems, | |||
and issue tracking systems that are managed by, or on behalf of, the | |||
Licensor for the purpose of discussing and improving the Work, but | |||
excluding communication that is conspicuously marked or otherwise | |||
designated in writing by the copyright owner as "Not a Contribution." | |||
"Contributor" shall mean Licensor and any individual or Legal Entity | |||
on behalf of whom a Contribution has been received by Licensor and | |||
subsequently incorporated within the Work. | |||
2. Grant of Copyright License. Subject to the terms and conditions of | |||
this License, each Contributor hereby grants to You a perpetual, | |||
worldwide, non-exclusive, no-charge, royalty-free, irrevocable | |||
copyright license to reproduce, prepare Derivative Works of, | |||
publicly display, publicly perform, sublicense, and distribute the | |||
Work and such Derivative Works in Source or Object form. | |||
3. Grant of Patent License. Subject to the terms and conditions of | |||
this License, each Contributor hereby grants to You a perpetual, | |||
worldwide, non-exclusive, no-charge, royalty-free, irrevocable | |||
(except as stated in this section) patent license to make, have made, | |||
use, offer to sell, sell, import, and otherwise transfer the Work, | |||
where such license applies only to those patent claims licensable | |||
by such Contributor that are necessarily infringed by their | |||
Contribution(s) alone or by combination of their Contribution(s) | |||
with the Work to which such Contribution(s) was submitted. If You | |||
institute patent litigation against any entity (including a | |||
cross-claim or counterclaim in a lawsuit) alleging that the Work | |||
or a Contribution incorporated within the Work constitutes direct | |||
or contributory patent infringement, then any patent licenses | |||
granted to You under this License for that Work shall terminate | |||
as of the date such litigation is filed. | |||
4. Redistribution. You may reproduce and distribute copies of the | |||
Work or Derivative Works thereof in any medium, with or without | |||
modifications, and in Source or Object form, provided that You | |||
meet the following conditions: | |||
(a) You must give any other recipients of the Work or | |||
Derivative Works a copy of this License; and | |||
(b) You must cause any modified files to carry prominent notices | |||
stating that You changed the files; and | |||
(c) You must retain, in the Source form of any Derivative Works | |||
that You distribute, all copyright, patent, trademark, and | |||
attribution notices from the Source form of the Work, | |||
excluding those notices that do not pertain to any part of | |||
the Derivative Works; and | |||
(d) If the Work includes a "NOTICE" text file as part of its | |||
distribution, then any Derivative Works that You distribute must | |||
include a readable copy of the attribution notices contained | |||
within such NOTICE file, excluding those notices that do not | |||
pertain to any part of the Derivative Works, in at least one | |||
of the following places: within a NOTICE text file distributed | |||
as part of the Derivative Works; within the Source form or | |||
documentation, if provided along with the Derivative Works; or, | |||
within a display generated by the Derivative Works, if and | |||
wherever such third-party notices normally appear. The contents | |||
of the NOTICE file are for informational purposes only and | |||
do not modify the License. You may add Your own attribution | |||
notices within Derivative Works that You distribute, alongside | |||
or as an addendum to the NOTICE text from the Work, provided | |||
that such additional attribution notices cannot be construed | |||
as modifying the License. | |||
You may add Your own copyright statement to Your modifications and | |||
may provide additional or different license terms and conditions | |||
for use, reproduction, or distribution of Your modifications, or | |||
for any such Derivative Works as a whole, provided Your use, | |||
reproduction, and distribution of the Work otherwise complies with | |||
the conditions stated in this License. | |||
5. Submission of Contributions. Unless You explicitly state otherwise, | |||
any Contribution intentionally submitted for inclusion in the Work | |||
by You to the Licensor shall be under the terms and conditions of | |||
this License, without any additional terms or conditions. | |||
Notwithstanding the above, nothing herein shall supersede or modify | |||
the terms of any separate license agreement you may have executed | |||
with Licensor regarding such Contributions. | |||
6. Trademarks. This License does not grant permission to use the trade | |||
names, trademarks, service marks, or product names of the Licensor, | |||
except as required for reasonable and customary use in describing the | |||
origin of the Work and reproducing the content of the NOTICE file. | |||
7. Disclaimer of Warranty. Unless required by applicable law or | |||
agreed to in writing, Licensor provides the Work (and each | |||
Contributor provides its Contributions) on an "AS IS" BASIS, | |||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or | |||
implied, including, without limitation, any warranties or conditions | |||
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A | |||
PARTICULAR PURPOSE. You are solely responsible for determining the | |||
appropriateness of using or redistributing the Work and assume any | |||
risks associated with Your exercise of permissions under this License. | |||
8. Limitation of Liability. In no event and under no legal theory, | |||
whether in tort (including negligence), contract, or otherwise, | |||
unless required by applicable law (such as deliberate and grossly | |||
negligent acts) or agreed to in writing, shall any Contributor be | |||
liable to You for damages, including any direct, indirect, special, | |||
incidental, or consequential damages of any character arising as a | |||
result of this License or out of the use or inability to use the | |||
Work (including but not limited to damages for loss of goodwill, | |||
work stoppage, computer failure or malfunction, or any and all | |||
other commercial damages or losses), even if such Contributor | |||
has been advised of the possibility of such damages. | |||
9. Accepting Warranty or Additional Liability. While redistributing | |||
the Work or Derivative Works thereof, You may choose to offer, | |||
and charge a fee for, acceptance of support, warranty, indemnity, | |||
or other liability obligations and/or rights consistent with this | |||
License. However, in accepting such obligations, You may act only | |||
on Your own behalf and on Your sole responsibility, not on behalf | |||
of any other Contributor, and only if You agree to indemnify, | |||
defend, and hold each Contributor harmless for any liability | |||
incurred by, or claims asserted against, such Contributor by reason | |||
of your accepting any such warranty or additional liability. | |||
END OF TERMS AND CONDITIONS | |||
APPENDIX: How to apply the Apache License to your work. | |||
To apply the Apache License to your work, attach the following | |||
boilerplate notice, with the fields enclosed by brackets "[]" | |||
replaced with your own identifying information. (Don't include | |||
the brackets!) The text should be enclosed in the appropriate | |||
comment syntax for the file format. We also recommend that a | |||
file or class name and description of purpose be included on the | |||
same "printed page" as the copyright notice for easier | |||
identification within third-party archives. | |||
Copyright [yyyy] [name of copyright owner] | |||
Licensed under the Apache License, Version 2.0 (the "License"); | |||
you may not use this file except in compliance with the License. | |||
You may obtain a copy of the License at | |||
http://www.apache.org/licenses/LICENSE-2.0 | |||
Unless required by applicable law or agreed to in writing, software | |||
distributed under the License is distributed on an "AS IS" BASIS, | |||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | |||
See the License for the specific language governing permissions and | |||
limitations under the License. | |||
APACHE POI SUBCOMPONENTS: | |||
Apache POI includes subcomponents with separate copyright notices and | |||
license terms. Your use of these subcomponents is subject to the terms | |||
and conditions of the following licenses: | |||
Office Open XML schemas (ooxml-schemas-1.*.jar) | |||
The Office Open XML schema definitions used by Apache POI are | |||
a part of the Office Open XML ECMA Specification (ECMA-376, [1]). | |||
As defined in section 9.4 of the ECMA bylaws [2], this specification | |||
is available to all interested parties without restriction: | |||
9.4 All documents when approved shall be made available to | |||
all interested parties without restriction. | |||
Furthermore, both Microsoft and Adobe have granted patent licenses | |||
to this work [3,4,5]. | |||
[1] http://www.ecma-international.org/publications/standards/Ecma-376.htm | |||
[2] http://www.ecma-international.org/memento/Ecmabylaws.htm | |||
[3] http://www.microsoft.com/openspecifications/en/us/programs/osp/default.aspx | |||
[4] http://www.ecma-international.org/publications/files/ECMA-ST/Ecma%20PATENT/ | |||
Patent%20statements%20ok/ECMA-376%20Edition%202%20Microsoft%20Patent%20Declaration.pdf | |||
[5] http://www.ecma-international.org/publications/files/ECMA-ST/Ecma%20PATENT/ | |||
Patent%20statements%20ok/ECMA-376%20Adobe%20Patent%20Declaration.pdf | |||
Bouncy Castle library (bcprov-*.jar, bcpg-*.jar, bcpkix-*.jar) | |||
Permission is hereby granted, free of charge, to any person obtaining a copy | |||
of this software and associated documentation files (the "Software"), to | |||
deal in the Software without restriction, including without limitation the | |||
rights to use, copy, modify, merge, publish, distribute, sublicense, and/or | |||
sell copies of the Software, and to permit persons to whom the Software is | |||
furnished to do so, subject to the following conditions: | |||
The above copyright notice and this permission notice shall be included in | |||
all copies or substantial portions of the Software. | |||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | |||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | |||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | |||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | |||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING | |||
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS | |||
IN THE SOFTWARE. | |||
JUnit test library (junit-4.*.jar) & JaCoCo (*jacoco*) | |||
Eclipse Public License - v 1.0 | |||
THE ACCOMPANYING PROGRAM IS PROVIDED UNDER THE TERMS OF THIS ECLIPSE PUBLIC | |||
LICENSE ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF THE PROGRAM | |||
CONSTITUTES RECIPIENT'S ACCEPTANCE OF THIS AGREEMENT. | |||
1. DEFINITIONS | |||
"Contribution" means: | |||
a) in the case of the initial Contributor, the initial code and documentation | |||
distributed under this Agreement, and | |||
b) in the case of each subsequent Contributor: | |||
i) changes to the Program, and | |||
ii) additions to the Program; | |||
where such changes and/or additions to the Program originate from and are | |||
distributed by that particular Contributor. A Contribution 'originates' from | |||
a Contributor if it was added to the Program by such Contributor itself or | |||
anyone acting on such Contributor's behalf. Contributions do not include | |||
additions to the Program which: (i) are separate modules of software | |||
distributed in conjunction with the Program under their own license agreement, | |||
and (ii) are not derivative works of the Program. | |||
"Contributor" means any person or entity that distributes the Program. | |||
"Licensed Patents" mean patent claims licensable by a Contributor which are | |||
necessarily infringed by the use or sale of its Contribution alone or when | |||
combined with the Program. | |||
"Program" means the Contributions distributed in accordance with this Agreement. | |||
"Recipient" means anyone who receives the Program under this Agreement, | |||
including all Contributors. | |||
2. GRANT OF RIGHTS | |||
a) Subject to the terms of this Agreement, each Contributor hereby grants | |||
Recipient a non-exclusive, worldwide, royalty-free copyright license to | |||
reproduce, prepare derivative works of, publicly display, publicly | |||
perform, distribute and sublicense the Contribution of such Contributor, | |||
if any, and such derivative works, in source code and object code form. | |||
b) Subject to the terms of this Agreement, each Contributor hereby grants | |||
Recipient a non-exclusive, worldwide, royalty-free patent license under | |||
Licensed Patents to make, use, sell, offer to sell, import and otherwise | |||
transfer the Contribution of such Contributor, if any, in source code | |||
and object code form. This patent license shall apply to the combination | |||
of the Contribution and the Program if, at the time the Contribution is | |||
added by the Contributor, such addition of the Contribution causes such | |||
combination to be covered by the Licensed Patents. The patent license | |||
shall not apply to any other combinations which include the Contribution. | |||
No hardware per se is licensed hereunder. | |||
c) Recipient understands that although each Contributor grants the licenses | |||
to its Contributions set forth herein, no assurances are provided by any | |||
Contributor that the Program does not infringe the patent or other | |||
intellectual property rights of any other entity. Each Contributor | |||
disclaims any liability to Recipient for claims brought by any other | |||
entity based on infringement of intellectual property rights or | |||
otherwise. As a condition to exercising the rights and licenses granted | |||
hereunder, each Recipient hereby assumes sole responsibility to secure | |||
any other intellectual property rights needed, if any. For example, if | |||
a third party patent license is required to allow Recipient to distribute | |||
the Program, it is Recipient's responsibility to acquire that license | |||
before distributing the Program. | |||
d) Each Contributor represents that to its knowledge it has sufficient | |||
copyright rights in its Contribution, if any, to grant the copyright | |||
license set forth in this Agreement. | |||
3. REQUIREMENTS | |||
A Contributor may choose to distribute the Program in object code form under | |||
its own license agreement, provided that: | |||
a) it complies with the terms and conditions of this Agreement; and | |||
b) its license agreement: | |||
i) effectively disclaims on behalf of all Contributors all warranties and | |||
conditions, express and implied, including warranties or conditions of | |||
title and non-infringement, and implied warranties or conditions of | |||
merchantability and fitness for a particular purpose; | |||
ii) effectively excludes on behalf of all Contributors all liability for | |||
damages, including direct, indirect, special, incidental and | |||
consequential damages, such as lost profits; | |||
iii) states that any provisions which differ from this Agreement are | |||
offered by that Contributor alone and not by any other party; and | |||
iv) states that source code for the Program is available from such | |||
Contributor, and informs licensees how to obtain it in a reasonable | |||
manner on or through a medium customarily used for software exchange. | |||
When the Program is made available in source code form: | |||
a) it must be made available under this Agreement; and | |||
b) a copy of this Agreement must be included with each copy of the Program. | |||
Contributors may not remove or alter any copyright notices contained | |||
within the Program. | |||
Each Contributor must identify itself as the originator of its Contribution, | |||
if any, in a manner that reasonably allows subsequent Recipients to identify | |||
the originator of the Contribution. | |||
4. COMMERCIAL DISTRIBUTION | |||
Commercial distributors of software may accept certain responsibilities with | |||
respect to end users, business partners and the like. While this license is | |||
intended to facilitate the commercial use of the Program, the Contributor | |||
who includes the Program in a commercial product offering should do so in a | |||
manner which does not create potential liability for other Contributors. | |||
Therefore, if a Contributor includes the Program in a commercial product | |||
offering, such Contributor ("Commercial Contributor") hereby agrees to | |||
defend and indemnify every other Contributor ("Indemnified Contributor") | |||
against any losses, damages and costs (collectively "Losses") arising from | |||
claims, lawsuits and other legal actions brought by a third party against | |||
the Indemnified Contributor to the extent caused by the acts or omissions | |||
of such Commercial Contributor in connection with its distribution of the | |||
Program in a commercial product offering. The obligations in this section | |||
do not apply to any claims or Losses relating to any actual or alleged | |||
intellectual property infringement. In order to qualify, an Indemnified | |||
Contributor must: a) promptly notify the Commercial Contributor in writing | |||
of such claim, and b) allow the Commercial Contributor to control, and | |||
cooperate with the Commercial Contributor in, the defense and any related | |||
settlement negotiations. The Indemnified Contributor may participate in any | |||
such claim at its own expense. | |||
For example, a Contributor might include the Program in a commercial product | |||
offering, Product X. That Contributor is then a Commercial Contributor. If | |||
that Commercial Contributor then makes performance claims, or offers | |||
warranties related to Product X, those performance claims and warranties are | |||
such Commercial Contributor's responsibility alone. Under this section, the | |||
Commercial Contributor would have to defend claims against the other | |||
Contributors related to those performance claims and warranties, and if a | |||
court requires any other Contributor to pay any damages as a result, the | |||
Commercial Contributor must pay those damages. | |||
5. NO WARRANTY | |||
EXCEPT AS EXPRESSLY SET FORTH IN THIS AGREEMENT, THE PROGRAM IS PROVIDED ON | |||
AN "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, EITHER | |||
EXPRESS OR IMPLIED INCLUDING, WITHOUT LIMITATION, ANY WARRANTIES OR | |||
CONDITIONS OF TITLE, NON-INFRINGEMENT, MERCHANTABILITY OR FITNESS FOR A | |||
PARTICULAR PURPOSE. Each Recipient is solely responsible for determining the | |||
appropriateness of using and distributing the Program and assumes all risks | |||
associated with its exercise of rights under this Agreement , including but | |||
not limited to the risks and costs of program errors, compliance with | |||
applicable laws, damage to or loss of data, programs or equipment, and | |||
unavailability or interruption of operations. | |||
6. DISCLAIMER OF LIABILITY | |||
EXCEPT AS EXPRESSLY SET FORTH IN THIS AGREEMENT, NEITHER RECIPIENT NOR ANY | |||
CONTRIBUTORS SHALL HAVE ANY LIABILITY FOR ANY DIRECT, INDIRECT, INCIDENTAL, | |||
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING WITHOUT LIMITATION | |||
LOST PROFITS), HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN | |||
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) | |||
ARISING IN ANY WAY OUT OF THE USE OR DISTRIBUTION OF THE PROGRAM OR THE | |||
EXERCISE OF ANY RIGHTS GRANTED HEREUNDER, EVEN IF ADVISED OF THE POSSIBILITY | |||
OF SUCH DAMAGES. | |||
7. GENERAL | |||
If any provision of this Agreement is invalid or unenforceable under | |||
applicable law, it shall not affect the validity or enforceability of the | |||
remainder of the terms of this Agreement, and without further action by the | |||
parties hereto, such provision shall be reformed to the minimum extent | |||
necessary to make such provision valid and enforceable. | |||
If Recipient institutes patent litigation against any entity (including a | |||
cross-claim or counterclaim in a lawsuit) alleging that the Program itself | |||
(excluding combinations of the Program with other software or hardware) | |||
infringes such Recipient's patent(s), then such Recipient's rights granted | |||
under Section 2(b) shall terminate as of the date such litigation is filed. | |||
All Recipient's rights under this Agreement shall terminate if it fails to | |||
comply with any of the material terms or conditions of this Agreement and | |||
does not cure such failure in a reasonable period of time after becoming | |||
aware of such noncompliance. If all Recipient's rights under this Agreement | |||
terminate, Recipient agrees to cease use and distribution of the Program as | |||
soon as reasonably practicable. However, Recipient's obligations under this | |||
Agreement and any licenses granted by Recipient relating to the Program | |||
shall continue and survive. | |||
Everyone is permitted to copy and distribute copies of this Agreement, but | |||
in order to avoid inconsistency the Agreement is copyrighted and may only | |||
be modified in the following manner. The Agreement Steward reserves the | |||
right to publish new versions (including revisions) of this Agreement from | |||
time to time. No one other than the Agreement Steward has the right to | |||
modify this Agreement. The Eclipse Foundation is the initial Agreement | |||
Steward. The Eclipse Foundation may assign the responsibility to serve as | |||
the Agreement Steward to a suitable separate entity. Each new version of | |||
the Agreement will be given a distinguishing version number. The Program | |||
(including Contributions) may always be distributed subject to the version | |||
of the Agreement under which it was received. In addition, after a new | |||
version of the Agreement is published, Contributor may elect to distribute | |||
the Program (including its Contributions) under the new version. Except as | |||
expressly stated in Sections 2(a) and 2(b) above, Recipient receives no | |||
rights or licenses to the intellectual property of any Contributor under | |||
this Agreement, whether expressly, by implication, estoppel or otherwise. | |||
All rights in the Program not expressly granted under this Agreement are | |||
reserved. | |||
This Agreement is governed by the laws of the State of New York and the | |||
intellectual property laws of the United States of America. No party to this | |||
Agreement will bring a legal action under this Agreement more than one year | |||
after the cause of action arose. Each party waives its rights to a jury | |||
trial in any resulting litigation. | |||
Hamcrest library (hamcrest-*.jar) & CuvesAPI / Curve API | |||
BSD License | |||
Copyright (c) 2000-2006, www.hamcrest.org | |||
All rights reserved. | |||
Redistribution and use in source and binary forms, with or without | |||
modification, are permitted provided that the following conditions are met: | |||
Redistributions of source code must retain the above copyright notice, this | |||
list of conditions and the following disclaimer. Redistributions in binary | |||
form must reproduce the above copyright notice, this list of conditions and | |||
the following disclaimer in the documentation and/or other materials | |||
provided with the distribution. | |||
Neither the name of Hamcrest nor the names of its contributors may be used | |||
to endorse or promote products derived from this software without specific | |||
prior written permission. | |||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" | |||
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | |||
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | |||
ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE | |||
LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR | |||
CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF | |||
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS | |||
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN | |||
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) | |||
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE | |||
POSSIBILITY OF SUCH DAMAGE. | |||
SLF4J library (slf4j-api-*.jar) | |||
Copyright (c) 2004-2013 QOS.ch | |||
All rights reserved. | |||
Permission is hereby granted, free of charge, to any person obtaining | |||
a copy of this software and associated documentation files (the | |||
"Software"), to deal in the Software without restriction, including | |||
without limitation the rights to use, copy, modify, merge, publish, | |||
distribute, sublicense, and/or sell copies of the Software, and to | |||
permit persons to whom the Software is furnished to do so, subject to | |||
the following conditions: | |||
The above copyright notice and this permission notice shall be | |||
included in all copies or substantial portions of the Software. | |||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, | |||
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF | |||
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND | |||
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE | |||
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION | |||
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION | |||
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
@@ -1,23 +0,0 @@ | |||
Apache POI | |||
Copyright 2003-2016 The Apache Software Foundation | |||
This product includes software developed by | |||
The Apache Software Foundation (https://www.apache.org/). | |||
This product contains parts that were originally based on software from BEA. | |||
Copyright (c) 2000-2003, BEA Systems, <http://www.bea.com/>. | |||
This product contains W3C XML Schema documents. Copyright 2001-2003 (c) | |||
World Wide Web Consortium (Massachusetts Institute of Technology, European | |||
Research Consortium for Informatics and Mathematics, Keio University) | |||
This product contains the Piccolo XML Parser for Java | |||
(http://piccolo.sourceforge.net/). Copyright 2002 Yuval Oren. | |||
This product contains the chunks_parse_cmds.tbl file from the vsdump program. | |||
Copyright (C) 2006-2007 Valek Filippov (frob@df.ru) | |||
This product contains parts of the eID Applet project | |||
(http://eid-applet.googlecode.com). Copyright (c) 2009-2014 | |||
FedICT (federal ICT department of Belgium), e-Contract.be BVBA (https://www.e-contract.be), | |||
Bart Hanssens from FedICT |
@@ -1,54 +0,0 @@ | |||
#! /bin/sh | |||
# | |||
# Licensed to the Apache Software Foundation (ASF) under one or more | |||
# contributor license agreements. See the NOTICE file distributed with | |||
# this work for additional information regarding copyright ownership. | |||
# The ASF licenses this file to You under the Apache License, Version 2.0 | |||
# (the "License"); you may not use this file except in compliance with | |||
# the License. You may obtain a copy of the License at | |||
# | |||
# http://www.apache.org/licenses/LICENSE-2.0 | |||
# | |||
# Unless required by applicable law or agreed to in writing, software | |||
# distributed under the License is distributed on an "AS IS" BASIS, | |||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | |||
# See the License for the specific language governing permissions and | |||
# limitations under the License. | |||
# | |||
# create md5 checksums and gpg signatures | |||
echo "If you use gpg2 you need to set GPG_BIN accordingly" | |||
GPG_BIN=gpg | |||
stty -echo | |||
echo "enter your GPG passphrase" | |||
read passphrase | |||
stty echo | |||
# Do we have md5sum and sha1sum? | |||
# (We can use openssl if not, but the files it produces aren't as nice) | |||
which md5sum > /dev/null | |||
LACKING_MD5SUM=$? | |||
which sha1sum > /dev/null | |||
LACKING_SHA1SUM=$? | |||
for i in *; do | |||
echo "" | |||
echo Signing $i | |||
echo $passphrase | $GPG_BIN --passphrase-fd 0 --output $i.asc --detach-sig --armor $i | |||
$GPG_BIN --verify $i.asc $i | |||
echo Hashing $i | |||
if [ "$LACKING_MD5SUM" = "1" ]; then | |||
openssl md5 < $i > $i.md5 | |||
else | |||
md5sum $i > $i.md5 | |||
fi | |||
if [ "$LACKING_SHA1SUM" = "1" ]; then | |||
openssl sha1 < $i > $i.sha1 | |||
else | |||
sha1sum $i > $i.sha1 | |||
fi | |||
done |
@@ -1,62 +0,0 @@ | |||
#! /bin/sh | |||
# | |||
# Licensed to the Apache Software Foundation (ASF) under one or more | |||
# contributor license agreements. See the NOTICE file distributed with | |||
# this work for additional information regarding copyright ownership. | |||
# The ASF licenses this file to You under the Apache License, Version 2.0 | |||
# (the "License"); you may not use this file except in compliance with | |||
# the License. You may obtain a copy of the License at | |||
# | |||
# http://www.apache.org/licenses/LICENSE-2.0 | |||
# | |||
# Unless required by applicable law or agreed to in writing, software | |||
# distributed under the License is distributed on an "AS IS" BASIS, | |||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | |||
# See the License for the specific language governing permissions and | |||
# limitations under the License. | |||
# | |||
# Shell script to deploy POI artifacts in a maven repository. | |||
# | |||
# Note, You should configure your settings.xml and add a server with id=apache-releases: | |||
# | |||
# <server> | |||
# <id>apache-releases</id> | |||
# <username>apacheId</username> | |||
# <password>mySecurePassw0rd</password> | |||
# </server> | |||
# | |||
# <profiles> | |||
# <profile> | |||
# <id>apache-releases</id> | |||
# <properties> | |||
# <gpg.passphrase><!-- Your GPG passphrase --></gpg.passphrase> | |||
# </properties> | |||
# </profile> | |||
# </profiles> | |||
# | |||
# Usage: | |||
# 1. ant dist | |||
# 2. cd build/dist | |||
# 3. ./mvn-deploy.sh | |||
M2_REPOSITORY=https://repository.apache.org/service/local/staging/deploy/maven2 | |||
VERSION=@VERSION@ | |||
DSTAMP=@DSTAMP@ | |||
for artifactId in poi poi-scratchpad poi-ooxml poi-examples poi-ooxml-schemas poi-excelant | |||
do | |||
SENDS="-Dfile=$artifactId-$VERSION-$DSTAMP.jar" | |||
SENDS="$SENDS -DpomFile=$artifactId-$VERSION.pom" | |||
if [ -r $artifactId-$VERSION-sources-$DSTAMP.jar ]; then | |||
SENDS="$SENDS -Dsources=$artifactId-$VERSION-sources-$DSTAMP.jar" | |||
fi | |||
if [ -r $artifactId-$VERSION-javadocs-$DSTAMP.jar ]; then | |||
SENDS="$SENDS -Djavadoc=$artifactId-$VERSION-javadocs-$DSTAMP.jar" | |||
fi | |||
mvn gpg:sign-and-deploy-file \ | |||
-DrepositoryId=apache-releases -P apache-releases \ | |||
-Durl=$M2_REPOSITORY \ | |||
$SENDS | |||
done |
@@ -1,70 +0,0 @@ | |||
<?xml version="1.0"?> | |||
<!-- | |||
Licensed to the Apache Software Foundation (ASF) under one or more | |||
contributor license agreements. See the NOTICE file distributed with | |||
this work for additional information regarding copyright ownership. | |||
The ASF licenses this file to You under the Apache License, Version 2.0 | |||
(the "License"); you may not use this file except in compliance with | |||
the License. You may obtain a copy of the License at | |||
http://www.apache.org/licenses/LICENSE-2.0 | |||
Unless required by applicable law or agreed to in writing, software | |||
distributed under the License is distributed on an "AS IS" BASIS, | |||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | |||
See the License for the specific language governing permissions and | |||
limitations under the License. | |||
--> | |||
<project xmlns="http://maven.apache.org/POM/4.0.0" | |||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | |||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> | |||
<modelVersion>4.0.0</modelVersion> | |||
<groupId>org.apache.poi</groupId> | |||
<artifactId>ooxml-schemas</artifactId> | |||
<version>@VERSION@</version> | |||
<packaging>jar</packaging> | |||
<name>OOXML schemas</name> | |||
<description>XmlBeans generated from the Ecma supplied xsds: | |||
http://www.ecma-international.org/publications/files/ECMA-ST/Office%20Open%20XML%20Part%204%20(DOCX).zip</description> | |||
<url>http://poi.apache.org/</url> | |||
<mailingLists> | |||
<mailingList> | |||
<name>POI Users List</name> | |||
<subscribe>user-subscribe@poi.apache.org</subscribe> | |||
<unsubscribe>user-unsubscribe@poi.apache.org</unsubscribe> | |||
<archive>http://mail-archives.apache.org/mod_mbox/poi-user/</archive> | |||
</mailingList> | |||
<mailingList> | |||
<name>POI Developer List</name> | |||
<subscribe>dev-subscribe@poi.apache.org</subscribe> | |||
<unsubscribe>dev-unsubscribe@poi.apache.org</unsubscribe> | |||
<archive>http://mail-archives.apache.org/mod_mbox/poi-dev/</archive> | |||
</mailingList> | |||
</mailingLists> | |||
<licenses> | |||
<license> | |||
<name>The Apache Software License, Version 2.0</name> | |||
<url>http://www.apache.org/licenses/LICENSE-2.0.txt</url> | |||
<distribution>repo</distribution> | |||
</license> | |||
</licenses> | |||
<organization> | |||
<name>Apache Software Foundation</name> | |||
<url>http://www.apache.org/</url> | |||
</organization> | |||
<dependencies> | |||
<dependency> | |||
<groupId>org.apache.xmlbeans</groupId> | |||
<artifactId>xmlbeans</artifactId> | |||
<version>2.3.0</version> | |||
</dependency> | |||
</dependencies> | |||
</project> |
@@ -1,79 +0,0 @@ | |||
<?xml version="1.0"?> | |||
<!-- | |||
Licensed to the Apache Software Foundation (ASF) under one or more | |||
contributor license agreements. See the NOTICE file distributed with | |||
this work for additional information regarding copyright ownership. | |||
The ASF licenses this file to You under the Apache License, Version 2.0 | |||
(the "License"); you may not use this file except in compliance with | |||
the License. You may obtain a copy of the License at | |||
http://www.apache.org/licenses/LICENSE-2.0 | |||
Unless required by applicable law or agreed to in writing, software | |||
distributed under the License is distributed on an "AS IS" BASIS, | |||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | |||
See the License for the specific language governing permissions and | |||
limitations under the License. | |||
--> | |||
<project xmlns="http://maven.apache.org/POM/4.0.0" | |||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | |||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> | |||
<modelVersion>4.0.0</modelVersion> | |||
<groupId>org.apache.poi</groupId> | |||
<artifactId>ooxml-security</artifactId> | |||
<version>@VERSION@</version> | |||
<packaging>jar</packaging> | |||
<name>OOXML security</name> | |||
<description> | |||
XmlBeans generated from various supplied xsds for encryption and signing: | |||
http://msdn.microsoft.com/en-us/library/dd925810(v=office.12).aspx | |||
http://www.ecma-international.org/publications/files/ECMA-ST/Office%20Open%20XML%201st%20edition%20Part%202%20(PDF).zip | |||
http://www.w3.org/TR/2002/REC-xmldsig-core-20020212/xmldsig-core-schema.xsd | |||
http://uri.etsi.org/01903/v1.3.2/XAdES.xsd | |||
http://uri.etsi.org/01903/v1.4.1/XAdESv141.xsd | |||
http://dublincore.org/schemas/xmls/qdc/2003/04/02/dc.xsd | |||
http://dublincore.org/schemas/xmls/qdc/2003/04/02/dcterms.xsd | |||
http://dublincore.org/schemas/xmls/qdc/2003/04/02/dcmitype.xsd | |||
</description> | |||
<url>http://poi.apache.org/</url> | |||
<mailingLists> | |||
<mailingList> | |||
<name>POI Users List</name> | |||
<subscribe>user-subscribe@poi.apache.org</subscribe> | |||
<unsubscribe>user-unsubscribe@poi.apache.org</unsubscribe> | |||
<archive>http://mail-archives.apache.org/mod_mbox/poi-user/</archive> | |||
</mailingList> | |||
<mailingList> | |||
<name>POI Developer List</name> | |||
<subscribe>dev-subscribe@poi.apache.org</subscribe> | |||
<unsubscribe>dev-unsubscribe@poi.apache.org</unsubscribe> | |||
<archive>http://mail-archives.apache.org/mod_mbox/poi-dev/</archive> | |||
</mailingList> | |||
</mailingLists> | |||
<licenses> | |||
<license> | |||
<name>The Apache Software License, Version 2.0</name> | |||
<url>http://www.apache.org/licenses/LICENSE-2.0.txt</url> | |||
<distribution>repo</distribution> | |||
</license> | |||
</licenses> | |||
<organization> | |||
<name>Apache Software Foundation</name> | |||
<url>http://www.apache.org/</url> | |||
</organization> | |||
<dependencies> | |||
<dependency> | |||
<groupId>org.apache.xmlbeans</groupId> | |||
<artifactId>xmlbeans</artifactId> | |||
<version>2.3.0</version> | |||
</dependency> | |||
</dependencies> | |||
</project> |
@@ -1,78 +0,0 @@ | |||
<?xml version="1.0"?> | |||
<!-- | |||
Licensed to the Apache Software Foundation (ASF) under one or more | |||
contributor license agreements. See the NOTICE file distributed with | |||
this work for additional information regarding copyright ownership. | |||
The ASF licenses this file to You under the Apache License, Version 2.0 | |||
(the "License"); you may not use this file except in compliance with | |||
the License. You may obtain a copy of the License at | |||
http://www.apache.org/licenses/LICENSE-2.0 | |||
Unless required by applicable law or agreed to in writing, software | |||
distributed under the License is distributed on an "AS IS" BASIS, | |||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | |||
See the License for the specific language governing permissions and | |||
limitations under the License. | |||
--> | |||
<project xmlns="http://maven.apache.org/POM/4.0.0" | |||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | |||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> | |||
<modelVersion>4.0.0</modelVersion> | |||
<groupId>org.apache.poi</groupId> | |||
<artifactId>poi-examples</artifactId> | |||
<version>@VERSION@</version> | |||
<packaging>jar</packaging> | |||
<name>Apache POI</name> | |||
<url>http://poi.apache.org/</url> | |||
<description>Apache POI Examples</description> | |||
<mailingLists> | |||
<mailingList> | |||
<name>POI Users List</name> | |||
<subscribe>user-subscribe@poi.apache.org</subscribe> | |||
<unsubscribe>user-unsubscribe@poi.apache.org</unsubscribe> | |||
<archive>http://mail-archives.apache.org/mod_mbox/poi-user/</archive> | |||
</mailingList> | |||
<mailingList> | |||
<name>POI Developer List</name> | |||
<subscribe>dev-subscribe@poi.apache.org</subscribe> | |||
<unsubscribe>dev-unsubscribe@poi.apache.org</unsubscribe> | |||
<archive>http://mail-archives.apache.org/mod_mbox/poi-dev/</archive> | |||
</mailingList> | |||
</mailingLists> | |||
<licenses> | |||
<license> | |||
<name>The Apache Software License, Version 2.0</name> | |||
<url>http://www.apache.org/licenses/LICENSE-2.0.txt</url> | |||
</license> | |||
</licenses> | |||
<organization> | |||
<name>Apache Software Foundation</name> | |||
<url>http://www.apache.org/</url> | |||
</organization> | |||
<dependencies> | |||
<dependency> | |||
<groupId>org.apache.poi</groupId> | |||
<artifactId>poi</artifactId> | |||
<version>@VERSION@</version> | |||
</dependency> | |||
<dependency> | |||
<groupId>org.apache.poi</groupId> | |||
<artifactId>poi-scratchpad</artifactId> | |||
<version>@VERSION@</version> | |||
</dependency> | |||
<dependency> | |||
<groupId>org.apache.poi</groupId> | |||
<artifactId>poi-ooxml</artifactId> | |||
<version>@VERSION@</version> | |||
</dependency> | |||
</dependencies> | |||
</project> |
@@ -1,78 +0,0 @@ | |||
<?xml version="1.0"?> | |||
<!-- | |||
Licensed to the Apache Software Foundation (ASF) under one or more | |||
contributor license agreements. See the NOTICE file distributed with | |||
this work for additional information regarding copyright ownership. | |||
The ASF licenses this file to You under the Apache License, Version 2.0 | |||
(the "License"); you may not use this file except in compliance with | |||
the License. You may obtain a copy of the License at | |||
http://www.apache.org/licenses/LICENSE-2.0 | |||
Unless required by applicable law or agreed to in writing, software | |||
distributed under the License is distributed on an "AS IS" BASIS, | |||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | |||
See the License for the specific language governing permissions and | |||
limitations under the License. | |||
--> | |||
<project xmlns="http://maven.apache.org/POM/4.0.0" | |||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | |||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> | |||
<modelVersion>4.0.0</modelVersion> | |||
<groupId>org.apache.poi</groupId> | |||
<artifactId>poi-excelant</artifactId> | |||
<version>@VERSION@</version> | |||
<packaging>jar</packaging> | |||
<name>Apache POI</name> | |||
<url>http://poi.apache.org/</url> | |||
<description>Apache POI Excel Ant Tasks</description> | |||
<mailingLists> | |||
<mailingList> | |||
<name>POI Users List</name> | |||
<subscribe>user-subscribe@poi.apache.org</subscribe> | |||
<unsubscribe>user-unsubscribe@poi.apache.org</unsubscribe> | |||
<archive>http://mail-archives.apache.org/mod_mbox/poi-user/</archive> | |||
</mailingList> | |||
<mailingList> | |||
<name>POI Developer List</name> | |||
<subscribe>dev-subscribe@poi.apache.org</subscribe> | |||
<unsubscribe>dev-unsubscribe@poi.apache.org</unsubscribe> | |||
<archive>http://mail-archives.apache.org/mod_mbox/poi-dev/</archive> | |||
</mailingList> | |||
</mailingLists> | |||
<licenses> | |||
<license> | |||
<name>The Apache Software License, Version 2.0</name> | |||
<url>http://www.apache.org/licenses/LICENSE-2.0.txt</url> | |||
</license> | |||
</licenses> | |||
<organization> | |||
<name>Apache Software Foundation</name> | |||
<url>http://www.apache.org/</url> | |||
</organization> | |||
<dependencies> | |||
<dependency> | |||
<groupId>org.apache.poi</groupId> | |||
<artifactId>poi</artifactId> | |||
<version>@VERSION@</version> | |||
</dependency> | |||
<dependency> | |||
<groupId>org.apache.poi</groupId> | |||
<artifactId>poi-ooxml</artifactId> | |||
<version>@VERSION@</version> | |||
</dependency> | |||
<dependency> | |||
<groupId>org.apache.ant</groupId> | |||
<artifactId>ant</artifactId> | |||
<version>1.8.2</version> | |||
</dependency> | |||
</dependencies> | |||
</project> |
@@ -1,68 +0,0 @@ | |||
<?xml version="1.0"?> | |||
<!-- | |||
Licensed to the Apache Software Foundation (ASF) under one or more | |||
contributor license agreements. See the NOTICE file distributed with | |||
this work for additional information regarding copyright ownership. | |||
The ASF licenses this file to You under the Apache License, Version 2.0 | |||
(the "License"); you may not use this file except in compliance with | |||
the License. You may obtain a copy of the License at | |||
http://www.apache.org/licenses/LICENSE-2.0 | |||
Unless required by applicable law or agreed to in writing, software | |||
distributed under the License is distributed on an "AS IS" BASIS, | |||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | |||
See the License for the specific language governing permissions and | |||
limitations under the License. | |||
--> | |||
<project xmlns="http://maven.apache.org/POM/4.0.0" | |||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | |||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> | |||
<modelVersion>4.0.0</modelVersion> | |||
<groupId>org.apache.poi</groupId> | |||
<artifactId>poi-ooxml-schemas</artifactId> | |||
<version>@VERSION@</version> | |||
<packaging>jar</packaging> | |||
<name>Apache POI</name> | |||
<url>http://poi.apache.org/</url> | |||
<description>Apache POI - Java API To Access Microsoft Format Files</description> | |||
<mailingLists> | |||
<mailingList> | |||
<name>POI Users List</name> | |||
<subscribe>user-subscribe@poi.apache.org</subscribe> | |||
<unsubscribe>user-unsubscribe@poi.apache.org</unsubscribe> | |||
<archive>http://mail-archives.apache.org/mod_mbox/poi-user/</archive> | |||
</mailingList> | |||
<mailingList> | |||
<name>POI Developer List</name> | |||
<subscribe>dev-subscribe@poi.apache.org</subscribe> | |||
<unsubscribe>dev-unsubscribe@poi.apache.org</unsubscribe> | |||
<archive>http://mail-archives.apache.org/mod_mbox/poi-dev/</archive> | |||
</mailingList> | |||
</mailingLists> | |||
<licenses> | |||
<license> | |||
<name>The Apache Software License, Version 2.0</name> | |||
<url>http://www.apache.org/licenses/LICENSE-2.0.txt</url> | |||
</license> | |||
</licenses> | |||
<organization> | |||
<name>Apache Software Foundation</name> | |||
<url>http://www.apache.org/</url> | |||
</organization> | |||
<dependencies> | |||
<dependency> | |||
<groupId>org.apache.xmlbeans</groupId> | |||
<artifactId>xmlbeans</artifactId> | |||
<version>2.6.0</version> | |||
</dependency> | |||
</dependencies> | |||
</project> |
@@ -1,78 +0,0 @@ | |||
<?xml version="1.0"?> | |||
<!-- | |||
Licensed to the Apache Software Foundation (ASF) under one or more | |||
contributor license agreements. See the NOTICE file distributed with | |||
this work for additional information regarding copyright ownership. | |||
The ASF licenses this file to You under the Apache License, Version 2.0 | |||
(the "License"); you may not use this file except in compliance with | |||
the License. You may obtain a copy of the License at | |||
http://www.apache.org/licenses/LICENSE-2.0 | |||
Unless required by applicable law or agreed to in writing, software | |||
distributed under the License is distributed on an "AS IS" BASIS, | |||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | |||
See the License for the specific language governing permissions and | |||
limitations under the License. | |||
--> | |||
<project xmlns="http://maven.apache.org/POM/4.0.0" | |||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | |||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> | |||
<modelVersion>4.0.0</modelVersion> | |||
<groupId>org.apache.poi</groupId> | |||
<artifactId>poi-ooxml</artifactId> | |||
<version>@VERSION@</version> | |||
<packaging>jar</packaging> | |||
<name>Apache POI</name> | |||
<url>http://poi.apache.org/</url> | |||
<description>Apache POI - Java API To Access Microsoft Format Files</description> | |||
<mailingLists> | |||
<mailingList> | |||
<name>POI Users List</name> | |||
<subscribe>user-subscribe@poi.apache.org</subscribe> | |||
<unsubscribe>user-unsubscribe@poi.apache.org</unsubscribe> | |||
<archive>http://mail-archives.apache.org/mod_mbox/poi-user/</archive> | |||
</mailingList> | |||
<mailingList> | |||
<name>POI Developer List</name> | |||
<subscribe>dev-subscribe@poi.apache.org</subscribe> | |||
<unsubscribe>dev-unsubscribe@poi.apache.org</unsubscribe> | |||
<archive>http://mail-archives.apache.org/mod_mbox/poi-dev/</archive> | |||
</mailingList> | |||
</mailingLists> | |||
<licenses> | |||
<license> | |||
<name>The Apache Software License, Version 2.0</name> | |||
<url>http://www.apache.org/licenses/LICENSE-2.0.txt</url> | |||
</license> | |||
</licenses> | |||
<organization> | |||
<name>Apache Software Foundation</name> | |||
<url>http://www.apache.org/</url> | |||
</organization> | |||
<dependencies> | |||
<dependency> | |||
<groupId>org.apache.poi</groupId> | |||
<artifactId>poi</artifactId> | |||
<version>@VERSION@</version> | |||
</dependency> | |||
<dependency> | |||
<groupId>org.apache.poi</groupId> | |||
<artifactId>poi-ooxml-schemas</artifactId> | |||
<version>@VERSION@</version> | |||
</dependency> | |||
<dependency> | |||
<groupId>com.github.virtuald</groupId> | |||
<artifactId>curvesapi</artifactId> | |||
<version>1.04</version> | |||
</dependency> | |||
</dependencies> | |||
</project> |
@@ -1,68 +0,0 @@ | |||
<?xml version="1.0"?> | |||
<!-- | |||
Licensed to the Apache Software Foundation (ASF) under one or more | |||
contributor license agreements. See the NOTICE file distributed with | |||
this work for additional information regarding copyright ownership. | |||
The ASF licenses this file to You under the Apache License, Version 2.0 | |||
(the "License"); you may not use this file except in compliance with | |||
the License. You may obtain a copy of the License at | |||
http://www.apache.org/licenses/LICENSE-2.0 | |||
Unless required by applicable law or agreed to in writing, software | |||
distributed under the License is distributed on an "AS IS" BASIS, | |||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | |||
See the License for the specific language governing permissions and | |||
limitations under the License. | |||
--> | |||
<project xmlns="http://maven.apache.org/POM/4.0.0" | |||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | |||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> | |||
<modelVersion>4.0.0</modelVersion> | |||
<groupId>org.apache.poi</groupId> | |||
<artifactId>poi-scratchpad</artifactId> | |||
<version>@VERSION@</version> | |||
<packaging>jar</packaging> | |||
<name>Apache POI</name> | |||
<url>http://poi.apache.org/</url> | |||
<description>Apache POI - Java API To Access Microsoft Format Files</description> | |||
<mailingLists> | |||
<mailingList> | |||
<name>POI Users List</name> | |||
<subscribe>user-subscribe@poi.apache.org</subscribe> | |||
<unsubscribe>user-unsubscribe@poi.apache.org</unsubscribe> | |||
<archive>http://mail-archives.apache.org/mod_mbox/poi-user/</archive> | |||
</mailingList> | |||
<mailingList> | |||
<name>POI Developer List</name> | |||
<subscribe>dev-subscribe@poi.apache.org</subscribe> | |||
<unsubscribe>dev-unsubscribe@poi.apache.org</unsubscribe> | |||
<archive>http://mail-archives.apache.org/mod_mbox/poi-dev/</archive> | |||
</mailingList> | |||
</mailingLists> | |||
<licenses> | |||
<license> | |||
<name>The Apache Software License, Version 2.0</name> | |||
<url>http://www.apache.org/licenses/LICENSE-2.0.txt</url> | |||
</license> | |||
</licenses> | |||
<organization> | |||
<name>Apache Software Foundation</name> | |||
<url>http://www.apache.org/</url> | |||
</organization> | |||
<dependencies> | |||
<dependency> | |||
<groupId>org.apache.poi</groupId> | |||
<artifactId>poi</artifactId> | |||
<version>@VERSION@</version> | |||
</dependency> | |||
</dependencies> | |||
</project> |
@@ -1,101 +0,0 @@ | |||
<?xml version="1.0"?> | |||
<!-- | |||
Licensed to the Apache Software Foundation (ASF) under one or more | |||
contributor license agreements. See the NOTICE file distributed with | |||
this work for additional information regarding copyright ownership. | |||
The ASF licenses this file to You under the Apache License, Version 2.0 | |||
(the "License"); you may not use this file except in compliance with | |||
the License. You may obtain a copy of the License at | |||
http://www.apache.org/licenses/LICENSE-2.0 | |||
Unless required by applicable law or agreed to in writing, software | |||
distributed under the License is distributed on an "AS IS" BASIS, | |||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | |||
See the License for the specific language governing permissions and | |||
limitations under the License. | |||
--> | |||
<project xmlns="http://maven.apache.org/POM/4.0.0" | |||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | |||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> | |||
<modelVersion>4.0.0</modelVersion> | |||
<groupId>org.apache.poi</groupId> | |||
<artifactId>poi</artifactId> | |||
<version>@VERSION@</version> | |||
<packaging>jar</packaging> | |||
<name>Apache POI</name> | |||
<url>http://poi.apache.org/</url> | |||
<description>Apache POI - Java API To Access Microsoft Format Files</description> | |||
<mailingLists> | |||
<mailingList> | |||
<name>POI Users List</name> | |||
<subscribe>user-subscribe@poi.apache.org</subscribe> | |||
<unsubscribe>user-unsubscribe@poi.apache.org</unsubscribe> | |||
<archive>http://mail-archives.apache.org/mod_mbox/poi-user/</archive> | |||
</mailingList> | |||
<mailingList> | |||
<name>POI Developer List</name> | |||
<subscribe>dev-subscribe@poi.apache.org</subscribe> | |||
<unsubscribe>dev-unsubscribe@poi.apache.org</unsubscribe> | |||
<archive>http://mail-archives.apache.org/mod_mbox/poi-dev/</archive> | |||
</mailingList> | |||
</mailingLists> | |||
<licenses> | |||
<license> | |||
<name>The Apache Software License, Version 2.0</name> | |||
<url>http://www.apache.org/licenses/LICENSE-2.0.txt</url> | |||
</license> | |||
</licenses> | |||
<organization> | |||
<name>Apache Software Foundation</name> | |||
<url>http://www.apache.org/</url> | |||
</organization> | |||
<dependencies> | |||
<dependency> | |||
<groupId>commons-logging</groupId> | |||
<artifactId>commons-logging</artifactId> | |||
<version>1.2</version> | |||
<scope>runtime</scope> | |||
<optional>true</optional> | |||
</dependency> | |||
<dependency> | |||
<groupId>log4j</groupId> | |||
<artifactId>log4j</artifactId> | |||
<version>1.2.17</version> | |||
<scope>runtime</scope> | |||
<optional>true</optional> | |||
</dependency> | |||
<dependency> | |||
<groupId>commons-codec</groupId> | |||
<artifactId>commons-codec</artifactId> | |||
<version>1.10</version> | |||
</dependency> | |||
<dependency> | |||
<groupId>org.hamcrest</groupId> | |||
<artifactId>hamcrest-core</artifactId> | |||
<scope>test</scope> | |||
<version>1.3</version> | |||
</dependency> | |||
<dependency> | |||
<groupId>junit</groupId> | |||
<artifactId>junit</artifactId> | |||
<scope>test</scope> | |||
<version>4.12</version> | |||
</dependency> | |||
<dependency> | |||
<groupId>org.apache.commons</groupId> | |||
<artifactId>commons-collections4</artifactId> | |||
<version>4.1</version> | |||
</dependency> | |||
</dependencies> | |||
</project> |
@@ -1,67 +0,0 @@ | |||
<?xml version="1.0"?> | |||
<!-- | |||
Licensed to the Apache Software Foundation (ASF) under one | |||
or more contributor license agreements. See the NOTICE file | |||
distributed with this work for additional information | |||
regarding copyright ownership. The ASF licenses this file | |||
to you under the Apache License, Version 2.0 (the | |||
"License"); you may not use this file except in compliance | |||
with the License. You may obtain a copy of the License at | |||
http://www.apache.org/licenses/LICENSE-2.0 | |||
Unless required by applicable law or agreed to in writing, | |||
software distributed under the License is distributed on an | |||
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | |||
KIND, either express or implied. See the License for the | |||
specific language governing permissions and limitations | |||
under the License. | |||
--> | |||
<!-- POI OSGi Bundle System --> | |||
<project name="POI OSGi Bundle" default="bundle" basedir=".." xmlns:mvn="antlib:org.apache.maven.artifact.ant"> | |||
<description>The Apache POI OSGi Bundle System.</description> | |||
<property name="bundle.lib" location="osgi/lib"/> | |||
<!-- TODO Import these from the parent build file --> | |||
<property name="repository.m2" value="http://repo1.maven.org"/> | |||
<property name="version.id" value="3.11-beta1"/> | |||
<property name="dist.dir" value="build/dist"/> | |||
<!-- jars in the /lib directory, see the fetch-bundle-jars target--> | |||
<property name="bundle.bnd.jar" location="${bundle.lib}/bnd-1.50.0.jar"/> | |||
<property name="bundle.bnd.url" value="${repository.m2}/maven2/biz/aQute/bnd/1.50.0/bnd-1.50.0.jar"/> | |||
<import file="../build.xml"/> | |||
<target name="check-bundle-jars"> | |||
<condition property="jars.bundle.present"> | |||
<available file="${bundle.bnd.jar}"/> | |||
</condition> | |||
</target> | |||
<target name="fetch-bundle-jars" unless="jars.bundle.present"> | |||
<mkdir dir="${bundle.lib}"/> | |||
<antcall target="downloadfile"> | |||
<param name="sourcefile" value="${bundle.bnd.url}"/> | |||
<param name="destfile" value="${bundle.bnd.jar}"/> | |||
</antcall> | |||
</target> | |||
<!-- | |||
<target name="bundle" depends="init, check-bundle-jars, fetch-bundle-jars, jar"> | |||
--> | |||
<target name="bundle" depends="init, check-bundle-jars, fetch-bundle-jars"> | |||
<taskdef resource="aQute/bnd/ant/taskdef.properties" classpath="${bundle.bnd.jar}"/> | |||
<mkdir dir="build/osgi"/> | |||
<bnd | |||
classpath="${dist.dir}/poi-${version.id}-${DSTAMP}.jar,${dist.dir}/poi-scratchpad-${version.id}-${DSTAMP}.jar,${dist.dir}/poi-ooxml-${version.id}-${DSTAMP}.jar" | |||
eclipse="false" | |||
failok="false" | |||
exceptions="true" | |||
output="build/osgi" | |||
files="test.bnd"/> | |||
<!-- TODO Include the settings from http://svn.apache.org/repos/asf/servicemix/smx4/bundles/trunk/poi-3.9/pom.xml --> | |||
<!-- TODO Make this actually spit out an OSGi Jar --> | |||
</target> | |||
</project> |
@@ -1,38 +0,0 @@ | |||
\u001B[1mSYNOPSIS\u001B[0m | |||
${project.description} | |||
Original Maven URLs: | |||
\u001B[33mmvn:${pkgGroupId}/poi/${pkgVersion}\u001B[0m | |||
\u001B[33mmvn:${pkgGroupId}/poi-ooxml/${pkgVersion}\u001B[0m | |||
\u001B[33mmvn:${pkgGroupId}/poi-scratchpad/${pkgVersion}\u001B[0m | |||
\u001B[1mDESCRIPTION\u001B[0m | |||
The Apache POI Project's mission is to create and maintain Java APIs for manipulating various file formats based | |||
upon the Office Open XML standards (OOXML) and Microsoft's OLE 2 Compound Document format (OLE2). In short, you can | |||
read and write MS Excel files using Java. In addition, you can read and write MS Word and MS PowerPoint files using | |||
Java. Apache POI is your Java Excel solution (for Excel 97-2008). We have a complete API for porting other OOXML and | |||
OLE2 formats and welcome others to participate. | |||
OLE2 files include most Microsoft Office files such as XLS, DOC, and PPT as well as MFC serialization API based file | |||
formats. The project provides APIs for the OLE2 Filesystem (POIFS) and OLE2 Document Properties (HPSF). | |||
Office OpenXML Format is the new standards based XML file format found in Microsoft Office 2007 and 2008. This | |||
includes XLSX, DOCX and PPTX. The project provides a low level API to support the Open Packaging Conventions using | |||
openxml4j. | |||
For each MS Office application there exists a component module that attempts to provide a common high level Java api | |||
to both OLE2 and OOXML document formats. This is most developed for Excel workbooks (SS=HSSF+XSSF). Work is | |||
progressing for Word documents (HWPF+XWPF) and PowerPoint presentations (HSLF+XSLF). | |||
The project has recently added support for Outlook (HSMF). Microsoft opened the specifications to this format in | |||
October 2007. We would welcome contributions. | |||
There are also projects for Visio (HDGF), TNEF (HMEF), and Publisher (HPBF). | |||
As a general policy we collaborate as much as possible with other projects to provide this functionality. | |||
Examples include: Cocoon for which there are serializers for HSSF; Open Office.org with whom we collaborate in | |||
documenting the XLS format; and Tika / Lucene, for which we provide format interpretors. | |||
When practical, we donate components directly to those projects for POI-enabling them. | |||
\u001B[1mSEE ALSO\u001B[0m | |||
\u001B[36mhttp://poi.apache.org/\u001B[0m |
@@ -1,229 +0,0 @@ | |||
<?xml version="1.0" encoding="UTF-8"?> | |||
<!-- | |||
Licensed to the Apache Software Foundation (ASF) under one | |||
or more contributor license agreements. See the NOTICE file | |||
distributed with this work for additional information | |||
regarding copyright ownership. The ASF licenses this file | |||
to you under the Apache License, Version 2.0 (the | |||
"License"); you may not use this file except in compliance | |||
with the License. You may obtain a copy of the License at | |||
http://www.apache.org/licenses/LICENSE-2.0 | |||
Unless required by applicable law or agreed to in writing, | |||
software distributed under the License is distributed on an | |||
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | |||
KIND, either express or implied. See the License for the | |||
specific language governing permissions and limitations | |||
under the License. | |||
--> | |||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> | |||
<modelVersion>4.0.0</modelVersion> | |||
<parent> | |||
<groupId>org.apache</groupId> | |||
<artifactId>apache</artifactId> | |||
<version>10</version> | |||
<relativePath /> | |||
</parent> | |||
<groupId>org.apache.poi</groupId> | |||
<artifactId>poi-bundle</artifactId> | |||
<packaging>bundle</packaging> | |||
<name>Apache POI OSGi bundle</name> | |||
<description> | |||
OSGi bundle that contains Apache POI, and the dependencies. | |||
</description> | |||
<url>http://poi.apache.org/</url> | |||
<version>${poi.version}</version> | |||
<!-- | |||
<version>3.12-beta2</version> | |||
<version>@VERSION@</version> | |||
--> | |||
<properties> | |||
<maven.compiler.source>1.6</maven.compiler.source> | |||
<maven.compiler.target>1.6</maven.compiler.target> | |||
<pax.exam.version>4.4.0</pax.exam.version> | |||
</properties> | |||
<dependencies> | |||
<dependency> | |||
<groupId>${project.groupId}</groupId> | |||
<artifactId>poi</artifactId> | |||
<version>${poi.version}</version> | |||
</dependency> | |||
<dependency> | |||
<groupId>${project.groupId}</groupId> | |||
<artifactId>poi-scratchpad</artifactId> | |||
<version>${poi.version}</version> | |||
</dependency> | |||
<dependency> | |||
<groupId>${project.groupId}</groupId> | |||
<artifactId>poi-ooxml</artifactId> | |||
<version>${poi.version}</version> | |||
</dependency> | |||
<!-- Test dependencies --> | |||
<dependency> | |||
<groupId>junit</groupId> | |||
<artifactId>junit</artifactId> | |||
<version>4.12</version> | |||
</dependency> | |||
<dependency> | |||
<groupId>org.ops4j.pax.exam</groupId> | |||
<artifactId>pax-exam-junit4</artifactId> | |||
<version>${pax.exam.version}</version> | |||
<scope>test</scope> | |||
</dependency> | |||
<dependency> | |||
<groupId>org.ops4j.pax.exam</groupId> | |||
<artifactId>pax-exam-container-native</artifactId> | |||
<version>${pax.exam.version}</version> | |||
<scope>test</scope> | |||
</dependency> | |||
<dependency> | |||
<groupId>org.apache.felix</groupId> | |||
<artifactId>org.apache.felix.framework</artifactId> | |||
<version>4.6.0</version> | |||
<scope>test</scope> | |||
</dependency> | |||
<dependency> | |||
<groupId>org.ops4j.pax.exam</groupId> | |||
<artifactId>pax-exam-link-assembly</artifactId> | |||
<version>${pax.exam.version}</version> | |||
<scope>test</scope> | |||
</dependency> | |||
<dependency> | |||
<groupId>org.ops4j.pax.url</groupId> | |||
<artifactId>pax-url-aether</artifactId> | |||
<version>2.3.0</version> | |||
<scope>test</scope> | |||
</dependency> | |||
<dependency> | |||
<groupId>javax.inject</groupId> | |||
<artifactId>javax.inject</artifactId> | |||
<version>1</version> | |||
<scope>test</scope> | |||
</dependency> | |||
<dependency> | |||
<groupId>org.osgi</groupId> | |||
<artifactId>org.osgi.core</artifactId> | |||
<version>5.0.0</version> | |||
<scope>provided</scope> | |||
</dependency> | |||
</dependencies> | |||
<build> | |||
<plugins> | |||
<plugin> | |||
<groupId>org.apache.felix</groupId> | |||
<artifactId>maven-bundle-plugin</artifactId> | |||
<extensions>true</extensions> | |||
<configuration> | |||
<instructions> | |||
<Bundle-Activator> | |||
org.apache.poi.osgi.Activator | |||
</Bundle-Activator> | |||
<Embed-Dependency> | |||
poi;inline=true, | |||
poi-scratchpad;inline=true, | |||
poi-ooxml;inline=true, | |||
poi-ooxml-schemas, | |||
xmlbeans | |||
</Embed-Dependency> | |||
<Embed-Transitive>true</Embed-Transitive> | |||
<Bundle-DocURL>${project.url}</Bundle-DocURL> | |||
<Export-Package> | |||
org.apache.poi.* | |||
</Export-Package> | |||
<Import-Package> | |||
!org.junit, | |||
*, | |||
org.apache.xmlbeans.impl.xpath.saxon;resolution:=optional, | |||
org.apache.xmlbeans.impl.xquery.saxon;resolution:=optional, | |||
org.bouncycastle.cert;resolution:=optional, | |||
org.bouncycastle.cert.ocsp;resolution:=optional, | |||
org.bouncycastle.cms.bc;resolution:=optional, | |||
org.bouncycastle.cert.jcajce;resolution:=optional, | |||
org.bouncycastle.operator;resolution:=optional, | |||
org.bouncycastle.operator.bc;resolution:=optional, | |||
org.bouncycastle.tsp;resolution:=optional, | |||
org.openxmlformats.schemas.officeDocument.x2006.math;resolution:=optional, | |||
org.openxmlformats.schemas.schemaLibrary.x2006.main;resolution:=optional, | |||
schemasMicrosoftComOfficePowerpoint;resolution:=optional, | |||
schemasMicrosoftComOfficeWord;resolution:=optional, | |||
</Import-Package> | |||
</instructions> | |||
</configuration> | |||
</plugin> | |||
<plugin> | |||
<artifactId>maven-compiler-plugin</artifactId> | |||
<version>3.2</version> | |||
<configuration> | |||
<source>${maven.compiler.source}</source> | |||
<target>${maven.compiler.target}</target> | |||
</configuration> | |||
</plugin> | |||
</plugins> | |||
</build> | |||
<profiles> | |||
<profile> | |||
<id>java6</id> | |||
<activation> | |||
<jdk>[1.6,)</jdk> | |||
</activation> | |||
<build> | |||
<plugins> | |||
<plugin> | |||
<artifactId>maven-assembly-plugin</artifactId> | |||
<executions> | |||
<execution> | |||
<phase>pre-integration-test</phase> | |||
<goals> | |||
<goal>single</goal> | |||
</goals> | |||
<configuration> | |||
<descriptor>test-bundles.xml</descriptor> | |||
<finalName>test</finalName> | |||
<attach>false</attach> | |||
</configuration> | |||
</execution> | |||
</executions> | |||
</plugin> | |||
<plugin> | |||
<artifactId>maven-failsafe-plugin</artifactId> | |||
<version>2.10</version> | |||
<executions> | |||
<execution> | |||
<goals> | |||
<goal>integration-test</goal> | |||
<goal>verify</goal> | |||
</goals> | |||
</execution> | |||
</executions> | |||
<configuration> | |||
<systemPropertyVariables> | |||
<org.ops4j.pax.logging.DefaultServiceLog.level> | |||
WARN | |||
</org.ops4j.pax.logging.DefaultServiceLog.level> | |||
</systemPropertyVariables> | |||
</configuration> | |||
</plugin> | |||
</plugins> | |||
</build> | |||
</profile> | |||
</profiles> | |||
<organization> | |||
<name>The Apache Software Founation</name> | |||
<url>http://www.apache.org</url> | |||
</organization> | |||
<scm> | |||
<url>http://svn.apache.org/viewvc/poi/trunk/osgi</url> | |||
<connection>scm:svn:http://svn.apache.org/repos/asf/poi/trunk/osgi</connection> | |||
<developerConnection>scm:svn:https://svn.apache.org/repos/asf/poi/trunk/osgi</developerConnection> | |||
</scm> | |||
</project> |
@@ -1,28 +0,0 @@ | |||
/* ==================================================================== | |||
Licensed to the Apache Software Foundation (ASF) under one or more | |||
contributor license agreements. See the NOTICE file distributed with | |||
this work for additional information regarding copyright ownership. | |||
The ASF licenses this file to You under the Apache License, Version 2.0 | |||
(the "License"); you may not use this file except in compliance with | |||
the License. You may obtain a copy of the License at | |||
http://www.apache.org/licenses/LICENSE-2.0 | |||
Unless required by applicable law or agreed to in writing, software | |||
distributed under the License is distributed on an "AS IS" BASIS, | |||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | |||
See the License for the specific language governing permissions and | |||
limitations under the License. | |||
==================================================================== */ | |||
package org.apache.poi.osgi; | |||
import org.osgi.framework.BundleActivator; | |||
import org.osgi.framework.BundleContext; | |||
public class Activator implements BundleActivator { | |||
public void start(BundleContext context) throws Exception { | |||
} | |||
public void stop(BundleContext context) throws Exception { | |||
} | |||
} |
@@ -1,84 +0,0 @@ | |||
/* ==================================================================== | |||
Licensed to the Apache Software Foundation (ASF) under one or more | |||
contributor license agreements. See the NOTICE file distributed with | |||
this work for additional information regarding copyright ownership. | |||
The ASF licenses this file to You under the Apache License, Version 2.0 | |||
(the "License"); you may not use this file except in compliance with | |||
the License. You may obtain a copy of the License at | |||
http://www.apache.org/licenses/LICENSE-2.0 | |||
Unless required by applicable law or agreed to in writing, software | |||
distributed under the License is distributed on an "AS IS" BASIS, | |||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | |||
See the License for the specific language governing permissions and | |||
limitations under the License. | |||
==================================================================== */ | |||
package org.apache.poi.osgi; | |||
import static org.junit.Assert.assertEquals; | |||
import static org.junit.Assert.assertTrue; | |||
import static org.ops4j.pax.exam.CoreOptions.bundle; | |||
import static org.ops4j.pax.exam.CoreOptions.junitBundles; | |||
import static org.ops4j.pax.exam.CoreOptions.options; | |||
import javax.inject.Inject; | |||
import java.io.ByteArrayInputStream; | |||
import java.io.ByteArrayOutputStream; | |||
import java.io.File; | |||
import java.io.IOException; | |||
import java.net.URISyntaxException; | |||
import org.apache.poi.hssf.usermodel.HSSFSheet; | |||
import org.apache.poi.hssf.usermodel.HSSFWorkbook; | |||
import org.junit.Test; | |||
import org.junit.runner.RunWith; | |||
import org.ops4j.pax.exam.Configuration; | |||
import org.ops4j.pax.exam.Option; | |||
import org.ops4j.pax.exam.junit.PaxExam; | |||
import org.ops4j.pax.exam.spi.reactors.ExamReactorStrategy; | |||
import org.ops4j.pax.exam.spi.reactors.PerMethod; | |||
import org.osgi.framework.Bundle; | |||
import org.osgi.framework.BundleContext; | |||
import org.osgi.framework.ServiceReference; | |||
/** | |||
* Test to ensure that all our main formats can create, write | |||
* and read back in, when running under OSGi | |||
*/ | |||
@RunWith(PaxExam.class) | |||
@ExamReactorStrategy(PerMethod.class) | |||
public class TestOSGiBundle { | |||
private final File TARGET = new File("target"); | |||
@Inject | |||
private BundleContext bc; | |||
@Configuration | |||
public Option[] configuration() throws IOException, URISyntaxException { | |||
File base = new File(TARGET, "test-bundles"); | |||
return options( | |||
junitBundles(), | |||
bundle(new File(base, "poi-bundle.jar").toURI().toURL().toString())); | |||
} | |||
@Test | |||
public void testHSSF() throws Exception { | |||
HSSFWorkbook wb = new HSSFWorkbook(); | |||
HSSFSheet s = wb.createSheet("OSGi"); | |||
s.createRow(0).createCell(0).setCellValue("With OSGi"); | |||
ByteArrayOutputStream baos = new ByteArrayOutputStream(); | |||
wb.write(baos); | |||
ByteArrayInputStream bais = new ByteArrayInputStream(baos.toByteArray()); | |||
wb = new HSSFWorkbook(bais); | |||
assertEquals(1, wb.getNumberOfSheets()); | |||
s = wb.getSheet("OSGi"); | |||
assertEquals("With OSGi", s.getRow(0).getCell(0).toString()); | |||
} | |||
} |
@@ -1,34 +0,0 @@ | |||
<!-- | |||
Licensed to the Apache Software Foundation (ASF) under one or more | |||
contributor license agreements. See the NOTICE file distributed with | |||
this work for additional information regarding copyright ownership. | |||
The ASF licenses this file to You under the Apache License, Version 2.0 | |||
(the "License"); you may not use this file except in compliance with | |||
the License. You may obtain a copy of the License at | |||
http://www.apache.org/licenses/LICENSE-2.0 | |||
Unless required by applicable law or agreed to in writing, software | |||
distributed under the License is distributed on an "AS IS" BASIS, | |||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | |||
See the License for the specific language governing permissions and | |||
limitations under the License. | |||
--> | |||
<assembly xmlns="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.2" | |||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | |||
xsi:schemaLocation="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.2 http://maven.apache.org/xsd/assembly-1.1.2.xsd"> | |||
<id>bundles</id> | |||
<formats> | |||
<format>dir</format> | |||
</formats> | |||
<includeBaseDirectory>false</includeBaseDirectory> | |||
<dependencySets> | |||
<dependencySet> | |||
<outputDirectory/> | |||
<outputFileNameMapping>${artifact.artifactId}.jar</outputFileNameMapping> | |||
<includes> | |||
<include>org.apache.poi:poi-bundle</include> | |||
</includes> | |||
</dependencySet> | |||
</dependencySets> | |||
</assembly> |
@@ -1,128 +0,0 @@ | |||
<?xml version="1.0" encoding="UTF-8"?> | |||
<!-- | |||
Licensed to the Apache Software Foundation (ASF) under one or more | |||
contributor license agreements. See the NOTICE file distributed with | |||
this work for additional information regarding copyright ownership. | |||
The ASF licenses this file to You under the Apache License, Version 2.0 | |||
(the "License"); you may not use this file except in compliance with | |||
the License. You may obtain a copy of the License at | |||
http://www.apache.org/licenses/LICENSE-2.0 | |||
Unless required by applicable law or agreed to in writing, software | |||
distributed under the License is distributed on an "AS IS" BASIS, | |||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | |||
See the License for the specific language governing permissions and | |||
limitations under the License. | |||
--> | |||
<!-- | |||
======================================================================= | |||
Use Apache Ant to generate a patch file. | |||
======================================================================= | |||
--> | |||
<project name="create-patch" default="patchpackage" basedir="."> | |||
<property environment="env"/> | |||
<property name="patch.package" value="patch.tar.gz"/> | |||
<property name="patch.file" value="patch.txt"/> | |||
<condition property="svn.found"> | |||
<or> | |||
<available file="svn" filepath="${env.PATH}"/> | |||
<available file="svn.exe" filepath="${env.PATH}"/> | |||
<available file="svn.exe" filepath="${env.Path}"/> | |||
</or> | |||
</condition> | |||
<target name="createpatch"> | |||
<fail unless="svn.found" message="You need a version of svn to create the patch"/> | |||
<exec executable="svn" output="${patch.file}"> | |||
<arg value="diff"/> | |||
</exec> | |||
</target> | |||
<target name="newfiles"> | |||
<exec executable="svn" output="${patch.file}.tmp"> | |||
<arg value="status"/> | |||
</exec> | |||
<!-- prepare the list of files to include in patch.tar.gz --> | |||
<loadfile srcfile="${patch.file}.tmp" property="tar.file.list"> | |||
<filterchain> | |||
<!-- capture any new files --> | |||
<linecontainsregexp> | |||
<regexp pattern="^(\?|A)......"/> | |||
</linecontainsregexp> | |||
<!-- filter out the first six characters --> | |||
<tokenfilter> | |||
<replaceregex pattern="^(.......)" replace=""/> | |||
</tokenfilter> | |||
<!--remove line breaks --> | |||
<striplinebreaks/> | |||
</filterchain> | |||
</loadfile> | |||
</target> | |||
<target name="patchpackage" depends="createpatch,newfiles"> | |||
<delete file="${patch.package}"/> | |||
<tar includes="${tar.file.list}" | |||
destfile="${patch.package}" | |||
basedir="." | |||
compression="gzip" > | |||
</tar> | |||
<delete file="${patch.file}.tmp"/> | |||
</target> | |||
<target name="apply" | |||
description="apply patch.tar.gz files generated by patchpackage"> | |||
<!-- | |||
extract patch.tar.gz to svn working copy | |||
$ tar xvzf patch.tar.gz | |||
--> | |||
<echo message="extracting ${patch.file} to working copy"/> | |||
<untar src="${patch.package}" | |||
dest="." | |||
failOnEmptyArchive="true" | |||
compression="gzip"> | |||
</untar> | |||
<!-- | |||
Apply the changes from patch.txt | |||
$ svn patch patch.txt | |||
--> | |||
<echo message="svn patch ${patch.file}"/> | |||
<fail unless="svn.found" message="You need a version of svn to create the patch"/> | |||
<exec executable="svn"> | |||
<arg value="patch"/> | |||
<arg value="${patch.file}"/> | |||
</exec> | |||
<delete file="${patch.file}"/> | |||
<!-- | |||
get a list of all new files in patch.tar.gz and store in tar.file.list filelist | |||
$ tar tf patch.tar.gz | grep -v patch\.txt | xargs svn add | |||
--> | |||
<echo message="Getting ${patch.file} file list"/> | |||
<delete dir="${patch.package}.tmp" quiet="false" failonerror="false" /> | |||
<untar src="${patch.package}" | |||
dest="${patch.package}.tmp" | |||
failOnEmptyArchive="true" | |||
compression="gzip"> | |||
</untar> | |||
<fileset dir="${patch.package}.tmp" | |||
id="tar.file.list" | |||
excludes="${patch.file}"/> | |||
<!-- add new files --> | |||
<echo message="Adding new files to svn working copy"/> | |||
<apply executable="svn" | |||
relative="true"> | |||
<arg value="add"/> | |||
<fileset refid="tar.file.list"/> | |||
</apply> | |||
<delete dir="${patch.package}.tmp"/> | |||
</target> | |||
</project> |
@@ -1,10 +0,0 @@ | |||
rootProject.name = 'poi' | |||
include 'main', 'ooxml', 'excelant', 'examples', 'scratchpad', 'integrationtest' | |||
project(':main').projectDir = new File(settingsDir, 'build/main') | |||
project(':ooxml').projectDir = new File(settingsDir, 'build/ooxml') | |||
project(':excelant').projectDir = new File(settingsDir, 'build/excelant') | |||
project(':examples').projectDir = new File(settingsDir, 'build/examples') | |||
project(':scratchpad').projectDir = new File(settingsDir, 'build/scratchpad') | |||
project(':integrationtest').projectDir = new File(settingsDir, 'build/integrationtest') |
@@ -1,76 +0,0 @@ | |||
<project xmlns="http://maven.apache.org/POM/4.0.0" | |||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | |||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 | |||
http://maven.apache.org/maven-v4_0_0.xsd"> | |||
<modelVersion>4.0.0</modelVersion> | |||
<parent> | |||
<groupId>org.apache.poi</groupId> | |||
<artifactId>poi-parent</artifactId> | |||
<version>3.16-beta1-SNAPSHOT</version> | |||
</parent> | |||
<artifactId>poi-examples</artifactId> | |||
<packaging>jar</packaging> | |||
<name>Apache POI Examples package</name> | |||
<build> | |||
<plugins> | |||
<!-- copy sources, resources and tests in place as otherwise Sonar does not pick them up correctly! --> | |||
<plugin> | |||
<artifactId>maven-resources-plugin</artifactId> | |||
<version>${maven.plugin.resources.version}</version> | |||
<executions> | |||
<execution> | |||
<id>copy-sources</id> | |||
<!-- here the phase you need --> | |||
<phase>generate-sources</phase> | |||
<goals> | |||
<goal>copy-resources</goal> | |||
</goals> | |||
<configuration> | |||
<outputDirectory>${basedir}/src/main/java</outputDirectory> | |||
<resources> | |||
<resource> | |||
<directory>../../src/examples/src</directory> | |||
</resource> | |||
</resources> | |||
</configuration> | |||
</execution> | |||
</executions> | |||
</plugin> | |||
<!-- clean copied sources afterwards --> | |||
<plugin> | |||
<artifactId>maven-clean-plugin</artifactId> | |||
<version>${maven.plugin.clean.version}</version> | |||
<configuration> | |||
<filesets> | |||
<fileset> | |||
<directory>src</directory> | |||
<followSymlinks>false</followSymlinks> | |||
</fileset> | |||
</filesets> | |||
</configuration> | |||
</plugin> | |||
</plugins> | |||
</build> | |||
<dependencies> | |||
<dependency> | |||
<groupId>${project.groupId}</groupId> | |||
<artifactId>poi-main</artifactId> | |||
<version>${project.version}</version> | |||
</dependency> | |||
<dependency> | |||
<groupId>${project.groupId}</groupId> | |||
<artifactId>poi-ooxml</artifactId> | |||
<version>${project.version}</version> | |||
</dependency> | |||
<!-- non-test dependency for UpdateEmbeddedDoc --> | |||
<dependency> | |||
<groupId>junit</groupId> | |||
<artifactId>junit</artifactId> | |||
<version>${junit.version}</version> | |||
</dependency> | |||
</dependencies> | |||
</project> |
@@ -1,114 +0,0 @@ | |||
<project xmlns="http://maven.apache.org/POM/4.0.0" | |||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | |||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 | |||
http://maven.apache.org/maven-v4_0_0.xsd"> | |||
<modelVersion>4.0.0</modelVersion> | |||
<parent> | |||
<groupId>org.apache.poi</groupId> | |||
<artifactId>poi-parent</artifactId> | |||
<version>3.16-beta1-SNAPSHOT</version> | |||
</parent> | |||
<artifactId>poi-excelant</artifactId> | |||
<packaging>jar</packaging> | |||
<name>Apache POI ExcelAnt package</name> | |||
<build> | |||
<plugins> | |||
<!-- copy sources, resources and tests in place as otherwise Sonar does not pick them up correctly! --> | |||
<plugin> | |||
<artifactId>maven-resources-plugin</artifactId> | |||
<version>${maven.plugin.resources.version}</version> | |||
<executions> | |||
<execution> | |||
<id>copy-sources</id> | |||
<!-- here the phase you need --> | |||
<phase>generate-sources</phase> | |||
<goals> | |||
<goal>copy-resources</goal> | |||
</goals> | |||
<configuration> | |||
<outputDirectory>${basedir}/src/main/java</outputDirectory> | |||
<resources> | |||
<resource> | |||
<directory>../../src/excelant/java</directory> | |||
</resource> | |||
</resources> | |||
</configuration> | |||
</execution> | |||
<execution> | |||
<id>copy-resources</id> | |||
<!-- here the phase you need --> | |||
<phase>generate-resources</phase> | |||
<goals> | |||
<goal>copy-resources</goal> | |||
</goals> | |||
<configuration> | |||
<outputDirectory>${basedir}/src/main/resources</outputDirectory> | |||
<resources> | |||
<resource> | |||
<directory>../../src/excelant/resources</directory> | |||
</resource> | |||
</resources> | |||
</configuration> | |||
</execution> | |||
<execution> | |||
<id>copy-tests</id> | |||
<!-- here the phase you need --> | |||
<phase>generate-test-sources</phase> | |||
<goals> | |||
<goal>copy-resources</goal> | |||
</goals> | |||
<configuration> | |||
<outputDirectory>${basedir}/src/test/java</outputDirectory> | |||
<resources> | |||
<resource> | |||
<directory>../../src/excelant/testcases</directory> | |||
</resource> | |||
</resources> | |||
</configuration> | |||
</execution> | |||
</executions> | |||
</plugin> | |||
<!-- clean copied sources afterwards --> | |||
<plugin> | |||
<artifactId>maven-clean-plugin</artifactId> | |||
<version>${maven.plugin.clean.version}</version> | |||
<configuration> | |||
<filesets> | |||
<fileset> | |||
<directory>src</directory> | |||
<followSymlinks>false</followSymlinks> | |||
</fileset> | |||
</filesets> | |||
</configuration> | |||
</plugin> | |||
</plugins> | |||
</build> | |||
<dependencies> | |||
<dependency> | |||
<groupId>${project.groupId}</groupId> | |||
<artifactId>poi-main</artifactId> | |||
<version>${project.version}</version> | |||
</dependency> | |||
<dependency> | |||
<groupId>${project.groupId}</groupId> | |||
<artifactId>poi-main</artifactId> | |||
<version>${project.version}</version> | |||
<type>test-jar</type> | |||
<scope>test</scope> | |||
</dependency> | |||
<dependency> | |||
<groupId>${project.groupId}</groupId> | |||
<artifactId>poi-ooxml</artifactId> | |||
<version>${project.version}</version> | |||
</dependency> | |||
<dependency> | |||
<groupId>org.apache.ant</groupId> | |||
<artifactId>ant</artifactId> | |||
<version>1.8.2</version> | |||
</dependency> | |||
</dependencies> | |||
</project> |
@@ -1,129 +0,0 @@ | |||
<project xmlns="http://maven.apache.org/POM/4.0.0" | |||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | |||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 | |||
http://maven.apache.org/maven-v4_0_0.xsd"> | |||
<modelVersion>4.0.0</modelVersion> | |||
<parent> | |||
<groupId>org.apache.poi</groupId> | |||
<artifactId>poi-parent</artifactId> | |||
<version>3.16-beta1-SNAPSHOT</version> | |||
</parent> | |||
<artifactId>poi-main</artifactId> | |||
<packaging>jar</packaging> | |||
<name>Apache POI Main package</name> | |||
<build> | |||
<plugins> | |||
<!-- copy sources, resources and tests in place as otherwise Sonar does not pick them up correctly! --> | |||
<plugin> | |||
<artifactId>maven-resources-plugin</artifactId> | |||
<version>${maven.plugin.resources.version}</version> | |||
<executions> | |||
<execution> | |||
<id>copy-sources</id> | |||
<phase>generate-sources</phase> | |||
<goals> | |||
<goal>copy-resources</goal> | |||
</goals> | |||
<configuration> | |||
<outputDirectory>${basedir}/src/main/java</outputDirectory> | |||
<resources> | |||
<resource> | |||
<directory>../../src/java</directory> | |||
</resource> | |||
</resources> | |||
</configuration> | |||
</execution> | |||
<execution> | |||
<id>copy-resources</id> | |||
<phase>generate-resources</phase> | |||
<goals> | |||
<goal>copy-resources</goal> | |||
</goals> | |||
<configuration> | |||
<outputDirectory>${basedir}/src/main/resources</outputDirectory> | |||
<resources> | |||
<resource> | |||
<directory>../../src/resources/main</directory> | |||
</resource> | |||
</resources> | |||
</configuration> | |||
</execution> | |||
<execution> | |||
<id>copy-tests</id> | |||
<!-- here the phase you need --> | |||
<phase>generate-test-sources</phase> | |||
<goals> | |||
<goal>copy-resources</goal> | |||
</goals> | |||
<configuration> | |||
<outputDirectory>${basedir}/src/test/java</outputDirectory> | |||
<resources> | |||
<resource> | |||
<directory>../../src/testcases</directory> | |||
</resource> | |||
</resources> | |||
</configuration> | |||
</execution> | |||
</executions> | |||
</plugin> | |||
<!-- clean copied sources afterwards --> | |||
<plugin> | |||
<artifactId>maven-clean-plugin</artifactId> | |||
<version>${maven.plugin.clean.version}</version> | |||
<configuration> | |||
<filesets> | |||
<fileset> | |||
<directory>src</directory> | |||
<followSymlinks>false</followSymlinks> | |||
</fileset> | |||
</filesets> | |||
</configuration> | |||
</plugin> | |||
<!-- provide the test-jar for other modules --> | |||
<plugin> | |||
<groupId>org.apache.maven.plugins</groupId> | |||
<artifactId>maven-jar-plugin</artifactId> | |||
<version>${maven.plugin.jar.version}</version> | |||
<executions> | |||
<execution> | |||
<goals> | |||
<goal>test-jar</goal> | |||
</goals> | |||
</execution> | |||
</executions> | |||
</plugin> | |||
<!-- set jvm parameters for surefire plugin --> | |||
<plugin> | |||
<groupId>org.apache.maven.plugins</groupId> | |||
<artifactId>maven-surefire-plugin</artifactId> | |||
<version>${maven.plugin.surefire.version}</version> | |||
<configuration> | |||
<argLine>-Duser.language=en -Duser.country=US -Xmx1024m -XX:MaxPermSize=256m -XX:-OmitStackTraceInFastThrow</argLine> | |||
</configuration> | |||
</plugin> | |||
</plugins> | |||
</build> | |||
<dependencies> | |||
<dependency> | |||
<groupId>org.apache.commons</groupId> | |||
<artifactId>commons-collections4</artifactId> | |||
<version>4.1</version> | |||
</dependency> | |||
<dependency> | |||
<groupId>commons-codec</groupId> | |||
<artifactId>commons-codec</artifactId> | |||
<version>1.10</version> | |||
</dependency> | |||
<dependency> | |||
<groupId>commons-logging</groupId> | |||
<artifactId>commons-logging</artifactId> | |||
<version>1.2</version> | |||
</dependency> | |||
</dependencies> | |||
</project> |
@@ -1,55 +0,0 @@ | |||
<project xmlns="http://maven.apache.org/POM/4.0.0" | |||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | |||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 | |||
http://maven.apache.org/maven-v4_0_0.xsd"> | |||
<modelVersion>4.0.0</modelVersion> | |||
<parent> | |||
<groupId>org.apache.poi</groupId> | |||
<artifactId>poi-parent</artifactId> | |||
<version>3.16-beta1-SNAPSHOT</version> | |||
<relativePath>..</relativePath> | |||
</parent> | |||
<artifactId>poi-ooxml-schema-encryption</artifactId> | |||
<packaging>jar</packaging> | |||
<name>Apache POI - Openxmlformats Encryption Schema package</name> | |||
<properties> | |||
<!-- see http://docs.codehaus.org/display/SONAR/Narrowing+the+Focus for details of this property --> | |||
<sonar.exclusions>target/generated-sources/*</sonar.exclusions> | |||
</properties> | |||
<build> | |||
<plugins> | |||
<plugin> | |||
<groupId>org.apache.maven.plugins</groupId> | |||
<artifactId>maven-antrun-plugin</artifactId> | |||
<version>${maven.plugin.antrun.version}</version> | |||
<executions> | |||
<execution> | |||
<id>unzip-schema</id> | |||
<phase>generate-sources</phase> | |||
<goals> | |||
<goal>run</goal> | |||
</goals> | |||
<configuration> | |||
<target> | |||
<copy todir="target/schemas"> | |||
<fileset dir="../../src/ooxml/resources/org/apache/poi/poifs/crypt" includes="encryption*.*"/> | |||
</copy> | |||
</target> | |||
</configuration> | |||
</execution> | |||
</executions> | |||
</plugin> | |||
</plugins> | |||
</build> | |||
<dependencies> | |||
<dependency> | |||
<groupId>org.apache.xmlbeans</groupId> | |||
<artifactId>xmlbeans</artifactId> | |||
<version>${xmlbeans.version}</version> | |||
</dependency> | |||
</dependencies> | |||
</project> |
@@ -1 +0,0 @@ | |||
This purpose of this marker file is solely to activate the xmlbeans maven profile. |
@@ -1,144 +0,0 @@ | |||
<project xmlns="http://maven.apache.org/POM/4.0.0" | |||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | |||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 | |||
http://maven.apache.org/maven-v4_0_0.xsd"> | |||
<modelVersion>4.0.0</modelVersion> | |||
<parent> | |||
<groupId>org.apache.poi</groupId> | |||
<artifactId>poi-parent</artifactId> | |||
<version>3.16-beta1-SNAPSHOT</version> | |||
<relativePath>..</relativePath> | |||
</parent> | |||
<artifactId>poi-ooxml-schema-security</artifactId> | |||
<packaging>jar</packaging> | |||
<name>Apache POI - Openxmlformats Security-Schema package</name> | |||
<properties> | |||
<!-- see http://docs.codehaus.org/display/SONAR/Narrowing+the+Focus for details of this property --> | |||
<sonar.exclusions>target/generated-sources/*</sonar.exclusions> | |||
<maven.compiler.fork>true</maven.compiler.fork> | |||
<xmlbeans.noUpa>true</xmlbeans.noUpa> | |||
<xmlbeans.noPvr>true</xmlbeans.noPvr> | |||
</properties> | |||
<build> | |||
<plugins> | |||
<!-- Download and unpack the OfficeOpenXML Schema and use xmlbeans to create classes from the XSDs --> | |||
<!-- use maven plugin instead of ant tasks get because of caching feature ... --> | |||
<plugin> | |||
<groupId>com.googlecode.maven-download-plugin</groupId> | |||
<artifactId>maven-download-plugin</artifactId> | |||
<version>${maven.plugin.download.version}</version> | |||
<executions> | |||
<execution> | |||
<id>install-xsds-part-1</id> | |||
<phase>generate-sources</phase> | |||
<goals><goal>wget</goal></goals> | |||
<configuration> | |||
<url>http://www.ecma-international.org/publications/files/ECMA-ST/Office%20Open%20XML%201st%20edition%20Part%202%20(PDF).zip</url> | |||
<unpack>true</unpack> | |||
<md5>c8f0eac388691d5be0d1647146400a10</md5> | |||
</configuration> | |||
</execution> | |||
<execution> | |||
<id>install-xsds-part-2</id> | |||
<phase>generate-sources</phase> | |||
<goals><goal>wget</goal></goals> | |||
<configuration> | |||
<outputDirectory>target/schemas</outputDirectory> | |||
<url>http://dublincore.org/schemas/xmls/qdc/2003/04/02/dc.xsd</url> | |||
</configuration> | |||
</execution> | |||
<execution> | |||
<id>install-xsds-part-3</id> | |||
<phase>generate-sources</phase> | |||
<goals><goal>wget</goal></goals> | |||
<configuration> | |||
<outputDirectory>target/schemas</outputDirectory> | |||
<url>http://dublincore.org/schemas/xmls/qdc/2003/04/02/dcterms.xsd</url> | |||
</configuration> | |||
</execution> | |||
<execution> | |||
<id>install-xsds-part-4</id> | |||
<phase>generate-sources</phase> | |||
<goals><goal>wget</goal></goals> | |||
<configuration> | |||
<outputDirectory>target/schemas</outputDirectory> | |||
<url>http://dublincore.org/schemas/xmls/qdc/2003/04/02/dcmitype.xsd</url> | |||
</configuration> | |||
</execution> | |||
<execution> | |||
<id>install-xsds-part-5</id> | |||
<phase>generate-sources</phase> | |||
<goals><goal>wget</goal></goals> | |||
<configuration> | |||
<outputDirectory>target/schemas</outputDirectory> | |||
<url>http://www.w3.org/TR/2002/REC-xmldsig-core-20020212/xmldsig-core-schema.xsd</url> | |||
</configuration> | |||
</execution> | |||
<execution> | |||
<id>install-xsds-part-6</id> | |||
<phase>generate-sources</phase> | |||
<goals><goal>wget</goal></goals> | |||
<configuration> | |||
<outputDirectory>target/schemas</outputDirectory> | |||
<url>http://uri.etsi.org/01903/v1.3.2/XAdES.xsd</url> | |||
</configuration> | |||
</execution> | |||
<execution> | |||
<id>install-xsds-part-7</id> | |||
<phase>generate-sources</phase> | |||
<goals><goal>wget</goal></goals> | |||
<configuration> | |||
<outputDirectory>target/schemas</outputDirectory> | |||
<url>http://uri.etsi.org/01903/v1.4.1/XAdESv141.xsd</url> | |||
</configuration> | |||
</execution> | |||
</executions> | |||
</plugin> | |||
<plugin> | |||
<groupId>org.apache.maven.plugins</groupId> | |||
<artifactId>maven-antrun-plugin</artifactId> | |||
<version>${maven.plugin.antrun.version}</version> | |||
<executions> | |||
<execution> | |||
<id>unzip-schema</id> | |||
<phase>generate-sources</phase> | |||
<goals> | |||
<goal>run</goal> | |||
</goals> | |||
<configuration> | |||
<target> | |||
<echo message="unzip schemas" /> | |||
<unzip src="target/OpenPackagingConventions-XMLSchema.zip" dest="target/schemas/" /> | |||
<copy file="../../src/ooxml/resources/org/apache/poi/poifs/crypt/signatureInfo.xsd" | |||
todir="target/schemas"/> | |||
</target> | |||
</configuration> | |||
</execution> | |||
</executions> | |||
</plugin> | |||
</plugins> | |||
</build> | |||
<dependencies> | |||
<dependency> | |||
<groupId>org.apache.xmlbeans</groupId> | |||
<artifactId>xmlbeans</artifactId> | |||
<version>${xmlbeans.version}</version> | |||
</dependency> | |||
<dependency> | |||
<groupId>${project.groupId}</groupId> | |||
<artifactId>poi-main</artifactId> | |||
<version>${project.version}</version> | |||
</dependency> | |||
<dependency> | |||
<groupId>${project.groupId}</groupId> | |||
<artifactId>poi-scratchpad</artifactId> | |||
<version>${project.version}</version> | |||
</dependency> | |||
</dependencies> | |||
</project> |
@@ -1 +0,0 @@ | |||
This purpose of this marker file is solely to activate the xmlbeans maven profile. |
@@ -1,89 +0,0 @@ | |||
<project xmlns="http://maven.apache.org/POM/4.0.0" | |||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | |||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 | |||
http://maven.apache.org/maven-v4_0_0.xsd"> | |||
<modelVersion>4.0.0</modelVersion> | |||
<parent> | |||
<groupId>org.apache.poi</groupId> | |||
<artifactId>poi-parent</artifactId> | |||
<version>3.16-beta1-SNAPSHOT</version> | |||
<relativePath>..</relativePath> | |||
</parent> | |||
<artifactId>poi-ooxml-schema</artifactId> | |||
<packaging>jar</packaging> | |||
<name>Apache POI - Openxmlformats Schema package</name> | |||
<properties> | |||
<!-- see http://docs.codehaus.org/display/SONAR/Narrowing+the+Focus for details of this property --> | |||
<sonar.exclusions>target/generated-sources/*</sonar.exclusions> | |||
<maven.compiler.fork>true</maven.compiler.fork> | |||
<xmlbeans.xsdconfig>${basedir}/../../src/ooxml/resources/org/apache/poi/schemas/ooxmlSchemas.xsdconfig</xmlbeans.xsdconfig> | |||
</properties> | |||
<build> | |||
<plugins> | |||
<!-- Download and unpack the OfficeOpenXML Schema and use xmlbeans to create classes from the XSDs --> | |||
<plugin> | |||
<groupId>com.googlecode.maven-download-plugin</groupId> | |||
<artifactId>maven-download-plugin</artifactId> | |||
<version>${maven.plugin.download.version}</version> | |||
<executions> | |||
<execution> | |||
<id>download-xsds</id> | |||
<phase>generate-sources</phase> | |||
<goals> | |||
<goal>wget</goal> | |||
</goals> | |||
<configuration> | |||
<url>http://www.ecma-international.org/publications/files/ECMA-ST/Office%20Open%20XML%201st%20edition%20Part%204%20(PDF).zip</url> | |||
<unpack>true</unpack> | |||
<md5>abe6bb6e7799e854934b3c634e8bcf7b</md5> | |||
</configuration> | |||
</execution> | |||
</executions> | |||
</plugin> | |||
<plugin> | |||
<groupId>org.apache.maven.plugins</groupId> | |||
<artifactId>maven-antrun-plugin</artifactId> | |||
<version>${maven.plugin.antrun.version}</version> | |||
<executions> | |||
<execution> | |||
<id>unzip-schema</id> | |||
<phase>generate-sources</phase> | |||
<configuration> | |||
<target> | |||
<echo message="unzip schemas" /> | |||
<unzip src="target/OfficeOpenXML-XMLSchema.zip" dest="target/schemas" /> | |||
<copy file="../../src/ooxml/resources/org/apache/poi/xdgf/visio.xsd" | |||
todir="target/schemas"/> | |||
</target> | |||
</configuration> | |||
<goals> | |||
<goal>run</goal> | |||
</goals> | |||
</execution> | |||
</executions> | |||
</plugin> | |||
</plugins> | |||
</build> | |||
<dependencies> | |||
<dependency> | |||
<groupId>${project.groupId}</groupId> | |||
<artifactId>poi-main</artifactId> | |||
<version>${project.version}</version> | |||
</dependency> | |||
<dependency> | |||
<groupId>${project.groupId}</groupId> | |||
<artifactId>poi-scratchpad</artifactId> | |||
<version>${project.version}</version> | |||
</dependency> | |||
<dependency> | |||
<groupId>org.apache.xmlbeans</groupId> | |||
<artifactId>xmlbeans</artifactId> | |||
<version>${xmlbeans.version}</version> | |||
</dependency> | |||
</dependencies> | |||
</project> |
@@ -1 +0,0 @@ | |||
This purpose of this marker file is solely to activate the xmlbeans maven profile. |
@@ -1,165 +0,0 @@ | |||
<project xmlns="http://maven.apache.org/POM/4.0.0" | |||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | |||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 | |||
http://maven.apache.org/maven-v4_0_0.xsd"> | |||
<modelVersion>4.0.0</modelVersion> | |||
<parent> | |||
<groupId>org.apache.poi</groupId> | |||
<artifactId>poi-parent</artifactId> | |||
<version>3.16-beta1-SNAPSHOT</version> | |||
</parent> | |||
<artifactId>poi-ooxml</artifactId> | |||
<packaging>jar</packaging> | |||
<name>Apache POI OOXML package</name> | |||
<build> | |||
<plugins> | |||
<!-- copy sources, resources and tests in place as otherwise Sonar does not pick them up correctly! --> | |||
<plugin> | |||
<artifactId>maven-resources-plugin</artifactId> | |||
<version>${maven.plugin.resources.version}</version> | |||
<executions> | |||
<execution> | |||
<id>copy-sources</id> | |||
<phase>generate-sources</phase> | |||
<goals> | |||
<goal>copy-resources</goal> | |||
</goals> | |||
<configuration> | |||
<outputDirectory>${basedir}/src/main/java</outputDirectory> | |||
<resources> | |||
<resource> | |||
<directory>../../src/ooxml/java</directory> | |||
</resource> | |||
</resources> | |||
</configuration> | |||
</execution> | |||
<execution> | |||
<id>copy-resources</id> | |||
<phase>generate-resources</phase> | |||
<goals> | |||
<goal>copy-resources</goal> | |||
</goals> | |||
<configuration> | |||
<outputDirectory>${basedir}/src/main/resources</outputDirectory> | |||
<resources> | |||
<resource> | |||
<directory>../../src/resources/ooxml</directory> | |||
</resource> | |||
</resources> | |||
</configuration> | |||
</execution> | |||
<execution> | |||
<id>copy-tests</id> | |||
<phase>generate-test-sources</phase> | |||
<goals> | |||
<goal>copy-resources</goal> | |||
</goals> | |||
<configuration> | |||
<outputDirectory>${basedir}/src/test/java</outputDirectory> | |||
<resources> | |||
<resource> | |||
<directory>../../src/ooxml/testcases</directory> | |||
</resource> | |||
</resources> | |||
</configuration> | |||
</execution> | |||
</executions> | |||
</plugin> | |||
<!-- clean copied sources afterwards --> | |||
<plugin> | |||
<artifactId>maven-clean-plugin</artifactId> | |||
<version>${maven.plugin.clean.version}</version> | |||
<configuration> | |||
<filesets> | |||
<fileset> | |||
<directory>src</directory> | |||
<followSymlinks>false</followSymlinks> | |||
</fileset> | |||
<fileset> | |||
<directory>build</directory> | |||
<followSymlinks>false</followSymlinks> | |||
</fileset> | |||
</filesets> | |||
</configuration> | |||
</plugin> | |||
<!-- set jvm parameters for surefire plugin --> | |||
<plugin> | |||
<groupId>org.apache.maven.plugins</groupId> | |||
<artifactId>maven-surefire-plugin</artifactId> | |||
<version>${maven.plugin.surefire.version}</version> | |||
<configuration> | |||
<argLine>-Duser.language=en -Duser.country=US -Xmx1024m -XX:MaxPermSize=256m -XX:-OmitStackTraceInFastThrow</argLine> | |||
</configuration> | |||
</plugin> | |||
</plugins> | |||
</build> | |||
<dependencies> | |||
<dependency> | |||
<groupId>${project.groupId}</groupId> | |||
<artifactId>poi-ooxml-schema</artifactId> | |||
<version>${project.version}</version> | |||
</dependency> | |||
<dependency> | |||
<groupId>${project.groupId}</groupId> | |||
<artifactId>poi-ooxml-schema-encryption</artifactId> | |||
<version>${project.version}</version> | |||
</dependency> | |||
<dependency> | |||
<groupId>${project.groupId}</groupId> | |||
<artifactId>poi-ooxml-schema-security</artifactId> | |||
<version>${project.version}</version> | |||
</dependency> | |||
<dependency> | |||
<groupId>${project.groupId}</groupId> | |||
<artifactId>poi-main</artifactId> | |||
<version>${project.version}</version> | |||
</dependency> | |||
<dependency> | |||
<groupId>${project.groupId}</groupId> | |||
<artifactId>poi-main</artifactId> | |||
<version>${project.version}</version> | |||
<type>test-jar</type> | |||
<scope>test</scope> | |||
</dependency> | |||
<dependency> | |||
<groupId>org.apache.xmlbeans</groupId> | |||
<artifactId>xmlbeans</artifactId> | |||
<version>${xmlbeans.version}</version> | |||
</dependency> | |||
<dependency> | |||
<groupId>org.bouncycastle</groupId> | |||
<artifactId>bcpkix-jdk15on</artifactId> | |||
<version>1.54</version> | |||
</dependency> | |||
<dependency> | |||
<groupId>org.bouncycastle</groupId> | |||
<artifactId>bcprov-jdk15on</artifactId> | |||
<version>1.54</version> | |||
</dependency> | |||
<dependency> | |||
<groupId>org.apache.santuario</groupId> | |||
<artifactId>xmlsec</artifactId> | |||
<version>2.0.5</version> | |||
</dependency> | |||
<dependency> | |||
<groupId>com.github.virtuald</groupId> | |||
<artifactId>curvesapi</artifactId> | |||
<version>1.04</version> | |||
</dependency> | |||
<!-- non-test dependency for OOXMLLite --> | |||
<dependency> | |||
<groupId>junit</groupId> | |||
<artifactId>junit</artifactId> | |||
<version>${junit.version}</version> | |||
</dependency> | |||
</dependencies> | |||
</project> |
@@ -1,272 +0,0 @@ | |||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> | |||
<modelVersion>4.0.0</modelVersion> | |||
<groupId>org.apache.poi</groupId> | |||
<artifactId>poi-parent</artifactId> | |||
<packaging>pom</packaging> | |||
<version>3.16-beta1-SNAPSHOT</version> | |||
<name>Apache POI - the Java API for Microsoft Documents</name> | |||
<description>Maven build of Apache POI for Sonar checks</description> | |||
<url>http://poi.apache.org/</url> | |||
<mailingLists> | |||
<mailingList> | |||
<name>POI Users List</name> | |||
<subscribe>user-subscribe@poi.apache.org</subscribe> | |||
<unsubscribe>user-unsubscribe@poi.apache.org</unsubscribe> | |||
<archive>http://mail-archives.apache.org/mod_mbox/poi-user/</archive> | |||
</mailingList> | |||
<mailingList> | |||
<name>POI Developer List</name> | |||
<subscribe>dev-subscribe@poi.apache.org</subscribe> | |||
<unsubscribe>dev-unsubscribe@poi.apache.org</unsubscribe> | |||
<archive>http://mail-archives.apache.org/mod_mbox/poi-dev/</archive> | |||
</mailingList> | |||
</mailingLists> | |||
<licenses> | |||
<license> | |||
<name>The Apache Software License, Version 2.0</name> | |||
<url>http://www.apache.org/licenses/LICENSE-2.0.txt</url> | |||
</license> | |||
</licenses> | |||
<organization> | |||
<name>Apache Software Foundation</name> | |||
<url>http://www.apache.org/</url> | |||
</organization> | |||
<issueManagement> | |||
<system>bugzilla</system> | |||
<url>https://issues.apache.org/bugzilla/</url> | |||
</issueManagement> | |||
<scm> | |||
<connection>scm:svn:http://svn.apache.org/repos/asf/poi/trunk</connection> | |||
<developerConnection>scm:svn:https://svn.apache.org/repos/asf/poi/trunk</developerConnection> | |||
<url>http://svn.apache.org/viewvc/poi</url> | |||
</scm> | |||
<modules> | |||
<module>main</module> | |||
<module>ooxml-schema</module> | |||
<module>ooxml-schema-encryption</module> | |||
<module>ooxml-schema-security</module> | |||
<module>ooxml</module> | |||
<module>scratchpad</module> | |||
<module>excelant</module> | |||
<module>examples</module> | |||
</modules> | |||
<properties> | |||
<project.build.sourceEncoding>ASCII</project.build.sourceEncoding> | |||
<!-- Try to disable running SVN blame as it causes errors here because the source is copied from the actual SVN location here! --> | |||
<sonar.scm.disabled>true</sonar.scm.disabled> | |||
<!-- define some of the third-party or plugin-versions globally to use the same in all modules --> | |||
<xmlbeans.version>2.6.0</xmlbeans.version> | |||
<junit.version>4.12</junit.version> | |||
<maven.plugin.resources.version>3.0.1</maven.plugin.resources.version> | |||
<maven.plugin.jar.version>3.0.1</maven.plugin.jar.version> | |||
<maven.plugin.clean.version>3.0.0</maven.plugin.clean.version> | |||
<maven.plugin.download.version>1.1.0</maven.plugin.download.version> | |||
<maven.plugin.antrun.version>1.8</maven.plugin.antrun.version> | |||
<maven.plugin.surefire.version>2.19.1</maven.plugin.surefire.version> | |||
</properties> | |||
<build> | |||
<pluginManagement> | |||
<plugins> | |||
<plugin> | |||
<groupId>org.apache.maven.plugins</groupId> | |||
<artifactId>maven-compiler-plugin</artifactId> | |||
<version>3.5.1</version> | |||
<configuration> | |||
<source>1.6</source> | |||
<target>1.6</target> | |||
</configuration> | |||
</plugin> | |||
</plugins> | |||
</pluginManagement> | |||
<plugins> | |||
<plugin> | |||
<groupId>org.apache.maven.plugins</groupId> | |||
<artifactId>maven-surefire-plugin</artifactId> | |||
<version>${maven.plugin.surefire.version}</version> | |||
<dependencies> | |||
<dependency> | |||
<groupId>org.apache.maven.surefire</groupId> | |||
<artifactId>surefire-junit47</artifactId> | |||
<version>${maven.plugin.surefire.version}</version> | |||
</dependency> | |||
</dependencies> | |||
<configuration> | |||
<systemPropertyVariables> | |||
<POI.testdata.path>../../test-data</POI.testdata.path> | |||
<java.awt.headless>true</java.awt.headless> | |||
<org.apache.poi.util.POILogger>org.apache.poi.util.NullLogger</org.apache.poi.util.POILogger> | |||
</systemPropertyVariables> | |||
<!-- use to following to analyze OOM issues: -XX:+HeapDumpOnOutOfMemoryError -XX:HeapDumpPath=/tmp --> | |||
<argLine>-Duser.language=en -Duser.country=US -Xmx1024m</argLine> | |||
<excludes> | |||
<exclude>**/All*Tests.java</exclude> | |||
<exclude>**/TestUnfixedBugs.java</exclude> | |||
<exclude>**/TestcaseRecordInputStream.java</exclude> | |||
<exclude>**/POITestCase.java</exclude> | |||
<!-- TODO: error about no public construct, seems to run with JUnit 3.8... --> | |||
<exclude>**/TestWordToConverterSuite*.java</exclude> | |||
<exclude>**/TestExcelConverterSuite*.java</exclude> | |||
</excludes> | |||
<!--test>TestPPTX2PNG</test--> | |||
<!--parallel>both</parallel> | |||
<threadCount>10</threadCount--> | |||
</configuration> | |||
</plugin> | |||
</plugins> | |||
</build> | |||
<dependencies> | |||
<dependency> | |||
<groupId>junit</groupId> | |||
<artifactId>junit</artifactId> | |||
<version>${junit.version}</version> | |||
<scope>test</scope> | |||
</dependency> | |||
</dependencies> | |||
<profiles> | |||
<!-- We need a fair amount of memory to compile the xml schema, --> | |||
<!-- but limit it in case it goes wrong! --> | |||
<!-- Pick the right amount based on 32 vs 64 bit jvm --> | |||
<!-- ********************************************************** --> | |||
<!-- If you are using IntelliJ, you might want to check --> | |||
<!-- http://stackoverflow.com/questions/24115142 --> | |||
<!-- ********************************************************** --> | |||
<profile> | |||
<id>32bitstuff</id> | |||
<activation> | |||
<property> | |||
<name>sun.arch.data.model</name> | |||
<value>32</value> | |||
</property> | |||
</activation> | |||
<properties> | |||
<maven.compiler.maxmem>512m</maven.compiler.maxmem> | |||
<argLine>-Xmx768m -XX:MaxPermSize=128m @{argLine}</argLine> | |||
</properties> | |||
</profile> | |||
<profile> | |||
<id>64bitstuff</id> | |||
<activation> | |||
<property> | |||
<name>sun.arch.data.model</name> | |||
<value>64</value> | |||
</property> | |||
</activation> | |||
<properties> | |||
<maven.compiler.maxmem>768m</maven.compiler.maxmem> | |||
<argLine>-Xmx1024m -XX:MaxPermSize=256m @{argLine}</argLine> | |||
</properties> | |||
</profile> | |||
<profile> | |||
<id>xmlbean</id> | |||
<activation> | |||
<file><exists>xmlbeans.marker</exists></file> | |||
</activation> | |||
<build> | |||
<plugins> | |||
<plugin> | |||
<groupId>org.codehaus.mojo</groupId> | |||
<artifactId>xmlbeans-maven-plugin</artifactId> | |||
<version>2.3.3</version> | |||
<executions> | |||
<execution> | |||
<phase>process-sources</phase> | |||
<goals> | |||
<goal>xmlbeans</goal> | |||
</goals> | |||
<configuration> | |||
<schemaDirectory>${basedir}/target/schemas</schemaDirectory> | |||
<javaSource>1.5</javaSource> | |||
<noJavac>true</noJavac> | |||
<noUpa>${xmlbeans.noUpa}</noUpa> | |||
<noPvr>${xmlbeans.noPvr}</noPvr> | |||
<xmlConfigs> | |||
<xmlConfig implementation="java.io.File">${basedir}/../../src/ooxml/resources/org/apache/poi/poifs/crypt/encryptionCertificate.xsdconfig</xmlConfig> | |||
<xmlConfig implementation="java.io.File">${basedir}/../../src/ooxml/resources/org/apache/poi/poifs/crypt/encryptionInfo.xsdconfig</xmlConfig> | |||
<xmlConfig implementation="java.io.File">${basedir}/../../src/ooxml/resources/org/apache/poi/poifs/crypt/encryptionPassword.xsdconfig</xmlConfig> | |||
<xmlConfig implementation="java.io.File">${basedir}/../../src/ooxml/resources/org/apache/poi/schemas/ooxmlSchemas.xsdconfig</xmlConfig> | |||
</xmlConfigs> | |||
</configuration> | |||
</execution> | |||
</executions> | |||
</plugin> | |||
<plugin> | |||
<artifactId>maven-antrun-plugin</artifactId> | |||
<version>${maven.plugin.antrun.version}</version> | |||
<executions> | |||
<execution> | |||
<id>copy-xmltype-and-xsdconfig</id> | |||
<phase>generate-sources</phase> | |||
<goals><goal>run</goal></goals> | |||
<configuration> | |||
<target> | |||
<copy todir="${basedir}/target/generated-sources/xmlbeans"> | |||
<fileset dir="${basedir}/../../src/ooxml/java"> | |||
<include name="org/apache/poi/POIXMLTypeLoader.java"/> | |||
<include name="org/apache/poi/util/DocumentHelper.java"/> | |||
<include name="org/apache/poi/util/SAXHelper.java"/> | |||
</fileset> | |||
<fileset dir="${basedir}/../../src/java"> | |||
<include name="org/apache/poi/util/POILogFactory.java"/> | |||
<include name="org/apache/poi/util/POILogger.java"/> | |||
<include name="org/apache/poi/util/NullLogger.java"/> | |||
<include name="org/apache/poi/util/Internal.java"/> | |||
</fileset> | |||
</copy> | |||
<copy todir="${basedir}/target/schemas"> | |||
<fileset dir="${basedir}/../../src/ooxml/resources/org/apache/poi/schemas"/> | |||
</copy> | |||
</target> | |||
</configuration> | |||
</execution> | |||
<execution> | |||
<id>replace-xmltypeloader</id> | |||
<phase>process-sources</phase> | |||
<goals><goal>run</goal></goals> | |||
<configuration> | |||
<target> | |||
<replace dir="${basedir}/target/generated-sources/xmlbeans" includes="**/*.java" excludes="**/impl/**"> | |||
<replacetoken>org.apache.xmlbeans.XmlBeans.getContextTypeLoader()</replacetoken> | |||
<replacevalue>org.apache.poi.POIXMLTypeLoader</replacevalue> | |||
</replace> | |||
</target> | |||
</configuration> | |||
</execution> | |||
<execution> | |||
<id>remove-xmltypeloader-from-schema-jar</id> | |||
<phase>prepare-package</phase> | |||
<goals><goal>run</goal></goals> | |||
<configuration> | |||
<target> | |||
<touch file="${basedir}/target/generated-sources/xmlbeans/.staleFlag"/> | |||
<delete dir="${basedir}/target/classes/org/apache"/> | |||
</target> | |||
</configuration> | |||
</execution> | |||
</executions> | |||
</plugin> | |||
</plugins> | |||
</build> | |||
<dependencies> | |||
<dependency> | |||
<groupId>org.apache.xmlbeans</groupId> | |||
<artifactId>xmlbeans</artifactId> | |||
<version>${xmlbeans.version}</version> | |||
</dependency> | |||
</dependencies> | |||
</profile> | |||
</profiles> | |||
</project> |
@@ -1,109 +0,0 @@ | |||
<project xmlns="http://maven.apache.org/POM/4.0.0" | |||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | |||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 | |||
http://maven.apache.org/maven-v4_0_0.xsd"> | |||
<modelVersion>4.0.0</modelVersion> | |||
<parent> | |||
<groupId>org.apache.poi</groupId> | |||
<artifactId>poi-parent</artifactId> | |||
<version>3.16-beta1-SNAPSHOT</version> | |||
</parent> | |||
<artifactId>poi-scratchpad</artifactId> | |||
<packaging>jar</packaging> | |||
<name>Apache POI Scratchpad package</name> | |||
<properties> | |||
<!-- Exclude some generated code from Sonar analysis --> | |||
<sonar.exclusions>src/main/java/org/apache/poi/hwpf/model/types/*,src/main/java/org/apache/poi/hdf/model/hdftypes/definitions/*</sonar.exclusions> | |||
</properties> | |||
<build> | |||
<plugins> | |||
<!-- copy sources, resources and tests in place as otherwise Sonar does not pick them up correctly! --> | |||
<plugin> | |||
<artifactId>maven-resources-plugin</artifactId> | |||
<version>${maven.plugin.resources.version}</version> | |||
<executions> | |||
<execution> | |||
<id>copy-sources</id> | |||
<!-- here the phase you need --> | |||
<phase>generate-sources</phase> | |||
<goals> | |||
<goal>copy-resources</goal> | |||
</goals> | |||
<configuration> | |||
<outputDirectory>${basedir}/src/main/java</outputDirectory> | |||
<resources> | |||
<resource> | |||
<directory>../../src/scratchpad/src</directory> | |||
</resource> | |||
</resources> | |||
</configuration> | |||
</execution> | |||
<execution> | |||
<id>copy-resources</id> | |||
<!-- here the phase you need --> | |||
<phase>generate-resources</phase> | |||
<goals> | |||
<goal>copy-resources</goal> | |||
</goals> | |||
<configuration> | |||
<outputDirectory>${basedir}/src/main/resources</outputDirectory> | |||
<resources> | |||
<resource> | |||
<directory>../../src/resources/scratchpad</directory> | |||
</resource> | |||
</resources> | |||
</configuration> | |||
</execution> | |||
<execution> | |||
<id>copy-tests</id> | |||
<!-- here the phase you need --> | |||
<phase>generate-test-sources</phase> | |||
<goals> | |||
<goal>copy-resources</goal> | |||
</goals> | |||
<configuration> | |||
<outputDirectory>${basedir}/src/test/java</outputDirectory> | |||
<resources> | |||
<resource> | |||
<directory>../../src/scratchpad/testcases</directory> | |||
</resource> | |||
</resources> | |||
</configuration> | |||
</execution> | |||
</executions> | |||
</plugin> | |||
<!-- clean copied sources afterwards --> | |||
<plugin> | |||
<artifactId>maven-clean-plugin</artifactId> | |||
<version>${maven.plugin.clean.version}</version> | |||
<configuration> | |||
<filesets> | |||
<fileset> | |||
<directory>src</directory> | |||
<followSymlinks>false</followSymlinks> | |||
</fileset> | |||
</filesets> | |||
</configuration> | |||
</plugin> | |||
</plugins> | |||
</build> | |||
<dependencies> | |||
<dependency> | |||
<groupId>${project.groupId}</groupId> | |||
<artifactId>poi-main</artifactId> | |||
<version>${project.version}</version> | |||
</dependency> | |||
<dependency> | |||
<groupId>${project.groupId}</groupId> | |||
<artifactId>poi-main</artifactId> | |||
<version>${project.version}</version> | |||
<type>test-jar</type> | |||
<scope>test</scope> | |||
</dependency> | |||
</dependencies> | |||
</project> |
@@ -1,332 +0,0 @@ | |||
# Licensed to the Apache Software Foundation (ASF) under one | |||
# or more contributor license agreements. See the NOTICE file | |||
# distributed with this work for additional information | |||
# regarding copyright ownership. The ASF licenses this file | |||
# to you under the Apache License, Version 2.0 (the | |||
# "License"); you may not use this file except in compliance | |||
# with the License. You may obtain a copy of the License at | |||
# | |||
# http://www.apache.org/licenses/LICENSE-2.0 | |||
# | |||
# Unless required by applicable law or agreed to in writing, | |||
# software distributed under the License is distributed on an | |||
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | |||
# KIND, either express or implied. See the License for the | |||
# specific language governing permissions and limitations | |||
# under the License. | |||
# Makefile for building Poi4R | |||
# | |||
# Supported operating systems: Linux, Mac OS X and Windows. | |||
# See INSTALL file for requirements. | |||
# | |||
# Steps to build | |||
# 1. Edit the sections below as documented | |||
# 2. make all | |||
# 3. make install | |||
# | |||
# The install target installs the Poi4R python extension in python's | |||
# site-packages directory. On Mac OS X, it also installs the gcj runtime | |||
# libraries into $(PREFIX)/lib. | |||
# | |||
# To successfully import the Poi4R extension into Ruby, all required | |||
# libraries need to be found. If the locations you chose are non-standard, | |||
# the relevant DYLD_LIBRARY_PATH (Mac OS X), LD_LIBRARY_PATH (Linux), or | |||
# PATH (Windows) need to be set accordingly. | |||
# | |||
VERSION=0.1.0 | |||
POI_VER=$(shell grep '<property name="version.id"' ../../../build.xml | awk -F'"' '{print $$4}') | |||
RUBY_VER=1.8 | |||
POI4R:=$(shell pwd) | |||
POI=$(POI4R)/poi-$(POI_VER) | |||
#DEBUG=1 | |||
# | |||
# You need to uncomment and edit the variables below in the section | |||
# corresponding to your operating system. | |||
# | |||
# PREFIX: where programs are normally installed on your system (Unix). | |||
# PREFIX_RUBY: where your version of python is installed. | |||
# GCJ_HOME: where GCC/GCJ is installed. | |||
# Windows drive-absolute paths need to be expressed cygwin style. | |||
# | |||
# Mac OS X (Darwin) | |||
#PREFIX=/usr/local | |||
#PREFIX_RUBY=/Library/Frameworks/Ruby.framework/Versions/$(RUBY_VER) | |||
#SWIG=$(PREFIX)/bin/swig | |||
#GCJ_HOME=/usr/local/gcc-3.4.1 | |||
#DB=$(POI4R)/db-$(DB_VER) | |||
#PREFIX_DB=/usr/local/BerkeleyDB.$(DB_LIB_VER) | |||
# Linux | |||
PREFIX=/usr | |||
PREFIX_RUBY=$(PREFIX) | |||
SWIG=$(PREFIX)/bin/swig | |||
GCJ_HOME=/usr | |||
#DB=$(POI4R)/db-$(DB_VER) | |||
#PREFIX_DB=$(PREFIX)/BerkeleyDB.$(DB_LIB_VER) | |||
# Windows | |||
#PREFIX_RUBY=/cygdrive/o/Python-2.3.2 | |||
#SWIG=/cygdrive/c/utils/bin/swig.exe | |||
#GCJ_HOME=/cygdrive/o/mingw-3.1 | |||
#DB=/cygdrive/o/db-$(DB_VER) | |||
#PREFIX_DB=$(DB) | |||
# | |||
# No edits required below | |||
# | |||
OS=$(shell uname) | |||
ifeq ($(findstring CYGWIN,$(OS)),CYGWIN) | |||
OS=Cygwin | |||
endif | |||
ifeq ($(findstring WINNT,$(OS)),WINNT) | |||
OS=Cygwin | |||
endif | |||
ifeq ($(DEBUG),1) | |||
COMP_OPT=DEBUG=1 | |||
SUFFIX=d | |||
_SUFFIX=_d | |||
BINDIR=debug | |||
else | |||
COMP_OPT= | |||
SUFFIX= | |||
_SUFFIX= | |||
BINDIR=release | |||
endif | |||
SWIG_OPT=-DSWIG_COBJECT_TYPES -DPOI4R_VER="'$(VERSION)'" -DPOI_VER="'$(POI_VER)'" | |||
JCCFLAGS=--encoding=UTF-8 | |||
#JCCFLAGS=--encoding=UTF-8 -findirect-dispatch | |||
ifeq ($(OS),Darwin) | |||
RUBY_SITE=$(PREFIX_RUBY)/lib/ruby$(RUBY_VER)/site-packages | |||
RUBY_INC=$(PREFIX_RUBY)/lib/ruby$(RUBY_VER) | |||
POI4R=$(BINDIR)/poi4r.so | |||
ifeq ($(DEBUG),1) | |||
CCFLAGS=-O0 -g | |||
LDFLAGS=-g | |||
else | |||
CCFLAGS=-O2 | |||
LDFLAGS= | |||
endif | |||
else | |||
ifeq ($(OS),Linux) | |||
RUBY_SITE=$(PREFIX_RUBY)/lib/ruby/site-ruby/$(RUBY_VER)/ | |||
RUBY_INC=$(PREFIX_RUBY)/lib/ruby/$(RUBY_VER)/i686-linux | |||
POI4R_LIB=$(BINDIR)/poi4r.so | |||
ifeq ($(DEBUG),1) | |||
CCFLAGS=-O0 -g -fPIC | |||
LDFLAGS=-g | |||
else | |||
CCFLAGS=-O2 -fPIC | |||
LDFLAGS= | |||
endif | |||
else | |||
ifeq ($(OS),Cygwin) | |||
RUBY_SITE=`cygpath -aw $(PREFIX_RUBY)/Lib/site-packages` | |||
RUBY_INC=`cygpath -aw $(PREFIX_RUBY)/Include` | |||
RUBY_PC=`cygpath -aw $(PREFIX_RUBY)/PC` | |||
POI4R_LIB=$(BINDIR)/poi4r$(_SUFFIX).so | |||
ifeq ($(DEBUG),1) | |||
CCFLAGS=-O -g | |||
LDFLAGS=-g | |||
else | |||
CCFLAGS=-O2 | |||
LDFLAGS= | |||
endif | |||
else | |||
RUBY=unknown | |||
RUBY_SITE=unknown | |||
endif | |||
endif | |||
endif | |||
CLASSES=$(BINDIR)/classes | |||
JAR_CLASSES=$(CLASSES)/jar | |||
CC=$(GCJ_HOME)/bin/gcc | |||
CXX=$(GCJ_HOME)/bin/g++ | |||
JCC=$(GCJ_HOME)/bin/gcj | |||
JCCH=$(GCJ_HOME)/bin/gcjh | |||
JAR=$(GCJ_HOME)/bin/jar | |||
POI_ZIP=poi-$(POI_VER).jar | |||
POI_JAR=poi-$(POI_VER).jar | |||
POI_JAR_WC=poi-$(POI_VER)-*.jar | |||
POI4R_CP:=$(BINDIR)/$(POI_JAR):$(CLASSES) | |||
OBJS=$(BINDIR)/poi.o $(BINDIR)/io.java.o $(BINDIR)/io.cpp.o | |||
LIBS=$(POI4R_LIB) | |||
default: all | |||
patches: | |||
env: | |||
ifndef PREFIX_RUBY | |||
@echo Operating system is $(OS) | |||
@echo You need to edit that section of the Makefile | |||
@false | |||
else | |||
@true | |||
endif | |||
$(BINDIR): | |||
mkdir -p $(BINDIR)/classes/jar | |||
DISTRIB=Poi-$(VERSION) | |||
ifeq ($(OS),Cygwin) | |||
POI4R_CP:=`cygpath -awp $(POI4R_CP)` | |||
endif | |||
ifeq ($(OS),Cygwin) | |||
_poi=`cygpath -aw $(POI)` | |||
else | |||
_poi=$(POI) | |||
endif | |||
$(BINDIR)/$(POI_JAR): | |||
cp ../../../build/dist/$(POI_JAR_WC) $(BINDIR)/$(POI_JAR) | |||
cd $(JAR_CLASSES); $(JAR) -xf ../../$(POI_JAR) | |||
$(BINDIR)/io.java.o: java/org/apache/poi/RubyOutputStream.java | |||
$(JCC) $(JCCFLAGS) -C -d $(CLASSES) java/org/apache/poi/RubyOutputStream.java | |||
$(JCC) $(JCCFLAGS) $(CCFLAGS) -I$(GCJ_HOME)/include -c -o $@ java/org/apache/poi/RubyOutputStream.java | |||
$(CLASSES)/org/apache/poi/RubyOutputStream.h: $(BINDIR)/io.java.o Makefile | |||
mkdir -p $(CLASSES)/org/apache/poi/hssf/usermodel | |||
$(JCCH) -d $(CLASSES) --classpath=$(JAR_CLASSES) org.apache.poi.hssf.usermodel.HSSFWorkbook | |||
$(JCCH) -d $(CLASSES) --classpath=$(JAR_CLASSES) org.apache.poi.hssf.usermodel.HSSFSheet | |||
$(JCCH) -d $(CLASSES) --classpath=$(JAR_CLASSES) org.apache.poi.hssf.usermodel.HSSFRow | |||
$(JCCH) -d $(CLASSES) --classpath=$(JAR_CLASSES) org.apache.poi.hssf.usermodel.HSSFCell | |||
$(JCCH) -d $(CLASSES) --classpath=$(JAR_CLASSES) org.apache.poi.hssf.usermodel.HSSFHeader | |||
$(JCCH) -d $(CLASSES) --classpath=$(JAR_CLASSES) org.apache.poi.hssf.usermodel.HSSFFooter | |||
$(JCCH) -d $(CLASSES) --classpath=$(JAR_CLASSES) org.apache.poi.hssf.usermodel.HSSFFont | |||
$(JCCH) -d $(CLASSES) --classpath=$(JAR_CLASSES) org.apache.poi.hssf.usermodel.HSSFDataFormat | |||
$(JCCH) -d $(CLASSES) --classpath=$(JAR_CLASSES) org.apache.poi.hssf.usermodel.HSSFCellStyle | |||
$(JCCH) -d $(CLASSES) --classpath=$(CLASSES) org.apache.poi.RubyOutputStream | |||
$(BINDIR)/io.cpp.o: $(CLASSES)/org/apache/poi/RubyOutputStream.h cpp/RubyIO.cpp $(BINDIR)/io.java.o | |||
$(JCC) -I$(RUBY_INC) -I$(GCJ_HOME)/include -I$(CLASSES) $(CCFLAGS) -c -o $@ cpp/RubyIO.cpp | |||
$(BINDIR)/poi.o: $(BINDIR)/$(POI_JAR) | |||
$(JCC) $(JCCFLAGS) $(CCFLAGS) -c -o $@ $(BINDIR)/$(POI_JAR) | |||
Poi4R_wrap.cxx: $(BINDIR)/io.cpp.o Poi4R.i | |||
ifdef SWIG | |||
$(SWIG) $(SWIG_OPT) -I$(CLASSES) -c++ -ruby Poi4R.i | |||
endif | |||
ifeq ($(OS),Darwin) | |||
$(POI4R_LIB): $(OBJS) Poi4R_wrap.cxx | |||
$(CXX) -shared -bundle -o $@ $(CCFLAGS) $(SWIG_OPT) $(DB_INC) -I$(GCJ_HOME)/include -I$(CLASSES) -I$(RUBY_INC) Poi4R_wrap.cxx $(OBJS) -L$(GCJ_HOME)/lib -lgcj -liconv -undefined suppress -flat_namespace -multiply_defined suppress | |||
else | |||
ifeq ($(OS),Linux) | |||
$(POI4R_LIB): $(OBJS) Poi4R_wrap.cxx | |||
$(CXX) -shared -o $@ $(CCFLAGS) $(SWIG_OPT) $(DB_INC) -I$(CLASSES) -I$(RUBY_INC) Poi4R_wrap.cxx $(OBJS) -lgcj | |||
else | |||
ifeq ($(OS),Cygwin) | |||
$(POI4R_LIB): $(OBJS) Poi4R_wrap.cxx | |||
$(CXX) -c $(CCFLAGS) $(PYDBG) -D_NO_OLDNAMES -D_off_t=off_t $(SWIG_OPT) $(DB_INC) -I$(CLASSES) -I$(RUBY_PC) -I$(RUBY_INC) -o $(BINDIR)/Poi4R_wrap.o Poi4R_wrap.cxx | |||
$(CXX) -shared $(LDFLAGS) -o $@ $(OBJS) `cygpath -aw $(PREFIX_RUBY)/python23$(_SUFFIX).dll` $(BINDIR)/Poi4R_wrap.o -lgcj -lwin32k -lws2_32 | |||
endif | |||
endif | |||
endif | |||
all: env $(BINDIR) $(LIBS) | |||
@echo build of $(POI4R_LIB) complete | |||
install:: all | |||
install Poi4R.rb $(RUBY_SITE) | |||
install $(POI4R_LIB) $(RUBY_SITE) | |||
ifeq ($(OS),Darwin) | |||
install:: | |||
install $(GCJ_HOME)/lib/libgcj.5.dylib $(PREFIX)/lib | |||
install $(GCJ_HOME)/lib/libstdc++.6.dylib $(PREFIX)/lib | |||
install $(GCJ_HOME)/lib/libgcc_s.1.0.dylib $(PREFIX)/lib | |||
else | |||
ifeq ($(OS),Linux) | |||
install:: | |||
else | |||
ifeq ($(OS),Cygwin) | |||
install:: | |||
endif | |||
endif | |||
endif | |||
clean: | |||
rm -rf $(BINDIR) Poi4R.rb* Poi4R_wrap.cxx | |||
realclean: clean | |||
rm -rf $(POI) $(STORE) $(DISTRIB) | |||
distrib:: | |||
mkdir -p $(DISTRIB)/python | |||
install Poi4R.rb $(DISTRIB)/python | |||
install $(POI4R_LIB) $(DISTRIB)/python | |||
install README $(DISTRIB) | |||
ifeq ($(OS),Darwin) | |||
distrib:: | |||
ifdef DB | |||
mkdir -p $(DISTRIB)/db | |||
install $(LIBDB_JAVA_LIB) $(DISTRIB)/db | |||
install libdb_java-$(DB_LIB_VER).la.osx $(DISTRIB)/db | |||
endif | |||
mkdir -p $(DISTRIB)/gcj | |||
install $(GCJ_HOME)/lib/libgcj.5.dylib $(DISTRIB)/gcj | |||
install $(GCJ_HOME)/lib/libstdc++.6.dylib $(DISTRIB)/gcj | |||
install $(GCJ_HOME)/lib/libgcc_s.1.0.dylib $(DISTRIB)/gcj | |||
else | |||
ifeq ($(OS),Linux) | |||
distrib:: | |||
ifdef DB | |||
mkdir -p $(DISTRIB)/db | |||
install $(LIBDB_JAVA_LIB) $(DISTRIB)/db | |||
endif | |||
mkdir -p $(DISTRIB)/gcj | |||
install $(GCJ_HOME)/lib/libgcj.so.5 $(DISTRIB)/gcj | |||
install $(GCJ_HOME)/lib/libstdc++.so.6 $(DISTRIB)/gcj | |||
install $(GCJ_HOME)/lib/libgcc_s.so.1 $(DISTRIB)/gcj | |||
else | |||
ifeq ($(OS),Cygwin) | |||
distrib:: | |||
ifdef DB | |||
mkdir -p $(DISTRIB)/db | |||
install $(LIBDB_JAVA_LIB) $(DISTRIB)/db | |||
endif | |||
endif | |||
endif | |||
endif | |||
@@ -1,614 +0,0 @@ | |||
/* ==================================================================== | |||
Licensed to the Apache Software Foundation (ASF) under one or more | |||
contributor license agreements. See the NOTICE file distributed with | |||
this work for additional information regarding copyright ownership. | |||
The ASF licenses this file to You under the Apache License, Version 2.0 | |||
(the "License"); you may not use this file except in compliance with | |||
the License. You may obtain a copy of the License at | |||
http://www.apache.org/licenses/LICENSE-2.0 | |||
Unless required by applicable law or agreed to in writing, software | |||
distributed under the License is distributed on an "AS IS" BASIS, | |||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | |||
See the License for the specific language governing permissions and | |||
limitations under the License. | |||
==================================================================== */ | |||
%module poi4r | |||
%{ | |||
#include <gcj/cni.h> | |||
#include <java/lang/Object.h> | |||
#include <java/lang/Thread.h> | |||
#include <java/lang/ThreadGroup.h> | |||
#include <java/lang/Runnable.h> | |||
#include <java/lang/String.h> | |||
#include <java/lang/Throwable.h> | |||
#include <java/lang/Comparable.h> | |||
#include <java/lang/Integer.h> | |||
#include <java/lang/Long.h> | |||
#include <java/lang/Float.h> | |||
#include <java/lang/Double.h> | |||
#include <java/io/StringWriter.h> | |||
#include <java/io/PrintWriter.h> | |||
#include <java/util/HashMap.h> | |||
#include <java/util/Date.h> | |||
#include <java/util/Calendar.h> | |||
#include <java/lang/System.h> | |||
#include "org/apache/poi/hssf/usermodel/HSSFWorkbook.h" | |||
#include "org/apache/poi/hssf/usermodel/HSSFSheet.h" | |||
#include "org/apache/poi/hssf/usermodel/HSSFRow.h" | |||
#include "org/apache/poi/hssf/usermodel/HSSFCell.h" | |||
#include "org/apache/poi/hssf/usermodel/HSSFFont.h" | |||
#include "org/apache/poi/hssf/usermodel/HSSFCellStyle.h" | |||
#include "org/apache/poi/hssf/usermodel/HSSFDataFormat.h" | |||
#include "org/apache/poi/hssf/usermodel/HSSFHeader.h" | |||
#include "org/apache/poi/hssf/usermodel/HSSFFooter.h" | |||
#include "org/apache/poi/RubyOutputStream.h" | |||
typedef ::org::apache::poi::hssf::usermodel::HSSFWorkbook *jhworkbook; | |||
typedef ::org::apache::poi::hssf::usermodel::HSSFSheet *jhsheet; | |||
typedef ::org::apache::poi::hssf::usermodel::HSSFRow *jhrow; | |||
typedef ::org::apache::poi::hssf::usermodel::HSSFCell *jhcell; | |||
typedef ::org::apache::poi::hssf::usermodel::HSSFCellStyle *jhcellstyle; | |||
typedef ::org::apache::poi::hssf::usermodel::HSSFFont *jhfont; | |||
typedef ::org::apache::poi::hssf::usermodel::HSSFFooter *jhfooter; | |||
typedef ::org::apache::poi::hssf::usermodel::HSSFHeader *jhheader; | |||
typedef ::org::apache::poi::hssf::usermodel::HSSFDataFormat *jhdataformat; | |||
typedef ::java::util::Date *jdate; | |||
typedef ::java::util::Calendar *jcalendar; | |||
typedef ::java::io::OutputStream *joutputstream; | |||
typedef ::java::io::InputStream *jinputstream; | |||
typedef ::java::util::Collection *jstringCollection; | |||
typedef ::java::util::Collection *jtermCollection; | |||
typedef ::java::util::Locale *jlocale; | |||
typedef ::java::lang::Comparable *jcomparable; | |||
typedef JArray<jobject> *jobjectArray; | |||
typedef JArray<jstring> *jstringArray; | |||
static java::lang::Thread *nextThread; | |||
static java::util::HashMap *objects; | |||
static void store_reference(jobject object) { | |||
java::lang::Integer *ji =new java::lang::Integer(java::lang::System::identityHashCode(object)); | |||
jobject jo = objects->get(ji); | |||
if (!jo) { | |||
// printf("put object in hash\n"); | |||
objects->put(ji,object); | |||
} | |||
} | |||
static VALUE jo2rv(jobject object, swig_type_info *descriptor) | |||
{ | |||
if (object == NULL) | |||
{ | |||
return Qnil; | |||
} | |||
else | |||
{ | |||
return SWIG_NewPointerObj((void *) object, descriptor, 0); | |||
} | |||
} | |||
static int cvtptr(VALUE value, void **jo, swig_type_info *info) | |||
{ | |||
if (SWIG_ConvertPtr(value, jo, info, 0) == 0) | |||
return 0; | |||
else | |||
{ | |||
return -1; | |||
} | |||
} | |||
static int rv2jo(VALUE rv, jobject *jo, swig_type_info *descriptor) | |||
{ | |||
if (NIL_P(rv)) | |||
*jo = NULL; | |||
else | |||
{ | |||
java::lang::Object *javaObj; | |||
if (cvtptr(rv, (void **) &javaObj, descriptor) == -1) | |||
return 0; | |||
*jo = javaObj; | |||
} | |||
return 1; | |||
} | |||
static jstring r2j(VALUE object) | |||
{ | |||
if (NIL_P(object)){ | |||
return NULL; | |||
} | |||
else { | |||
char *ps = STR2CSTR(object); | |||
jstring js = JvNewStringLatin1(ps); | |||
if (!js) | |||
{ | |||
rb_raise(rb_eRuntimeError, "ruby str cannot be converted to java: %s",ps); | |||
} | |||
return js; | |||
} | |||
} | |||
VALUE j2r(jstring js) | |||
{ | |||
if (!js) | |||
{ | |||
return Qnil; | |||
} | |||
else | |||
{ | |||
jint len = JvGetStringUTFLength(js); | |||
char buf[len + 1]; | |||
JvGetStringUTFRegion(js, 0, len, buf); | |||
buf[len] = '\0'; | |||
return rb_str_new2(buf); | |||
} | |||
} | |||
static void free_java_obj(void* arg1) { | |||
jobject object =(jobject) arg1; | |||
java::lang::Integer *ji =new java::lang::Integer(java::lang::System::identityHashCode(object)); | |||
jobject jo = objects->get(ji); | |||
if (jo) { | |||
// printf("removed object from hash\n"); | |||
objects->remove(ji); | |||
} | |||
} | |||
static void raise_ruby_error(java::lang::Throwable *e) { | |||
java::io::StringWriter *buffer = new java::io::StringWriter(); | |||
java::io::PrintWriter *writer = new java::io::PrintWriter(buffer); | |||
e->printStackTrace(writer); | |||
writer->close(); | |||
jstring message = buffer->toString(); | |||
jint len = JvGetStringUTFLength(message); | |||
char buf[len + 1]; | |||
JvGetStringUTFRegion(message, 0, len, buf); | |||
buf[len] = '\0'; | |||
rb_raise(rb_eRuntimeError, "error calling poi \n %s", buf); | |||
} | |||
%} | |||
typedef long jint; | |||
typedef long long jlong; | |||
typedef char jbyte; | |||
typedef float jfloat; | |||
typedef float jdouble; | |||
typedef int jshort; | |||
typedef bool jboolean; | |||
%typemap(in) SWIGTYPE * { | |||
if (!rv2jo($input, (jobject *) &$1, $1_descriptor)) | |||
rb_raise(rb_eRuntimeError, "Unrecoverable error in SWIG typemapping"); | |||
} | |||
%typemap(out) SWIGTYPE * { | |||
$result = jo2rv($1, $1_descriptor); | |||
} | |||
%typemap(in) org::apache::poi::hssf::usermodel::HSSFWorkbook{ | |||
if (!rv2jo($input, (jobject *) &$1, | |||
$descriptor(org::apache::poi::hssf::usermodel::HSSFWorkbook *))) | |||
SWIG_fail; | |||
} | |||
%typemap(out) org::apache::poi::hssf::usermodel::HSSFWorkbook { | |||
$result = jo2rv($1, $descriptor(org::apache::poi::hssf::usermodel::HSSFWorkbook *)); | |||
} | |||
%typemap(in) jhsheet{ | |||
if (!rv2jo($input, (jobject *) &$1, | |||
$descriptor(org::apache::poi::hssf::usermodel::HSSFSheet *))) | |||
SWIG_fail; | |||
} | |||
%typemap(out) jhsheet { | |||
$result = jo2rv($1, $descriptor(org::apache::poi::hssf::usermodel::HSSFSheet *)); | |||
} | |||
%typemap(in) jhrow{ | |||
if (!rv2jo($input, (jobject *) &$1, | |||
$descriptor(org::apache::poi::hssf::usermodel::HSSFRow *))) | |||
SWIG_fail; | |||
} | |||
%typemap(out) jhrow { | |||
$result = jo2rv($1, $descriptor(org::apache::poi::hssf::usermodel::HSSFRow *)); | |||
} | |||
%typemap(in) jhcell{ | |||
if (!rv2jo($input, (jobject *) &$1, | |||
$descriptor(org::apache::poi::hssf::usermodel::HSSFCell *))) | |||
SWIG_fail; | |||
} | |||
%typemap(out) jhcell { | |||
$result = jo2rv($1, $descriptor(org::apache::poi::hssf::usermodel::HSSFCell *)); | |||
} | |||
%typemap(in) jhfont{ | |||
if (!rv2jo($input, (jobject *) &$1, | |||
$descriptor(org::apache::poi::hssf::usermodel::HSSFFont *))) | |||
rb_raise(rb_eRuntimeError, "Unrecoverable error in SWIG typemapping of HSSFFont"); | |||
} | |||
%typemap(out) jhfont { | |||
$result = jo2rv($1, $descriptor(org::apache::poi::hssf::usermodel::HSSFFont *)); | |||
} | |||
%typemap(in) jhcellstyle{ | |||
if (!rv2jo($input, (jobject *) &$1, | |||
$descriptor(org::apache::poi::hssf::usermodel::HSSFCellStyle *))) | |||
rb_raise(rb_eRuntimeError, "Unrecoverable error in SWIG typemapping of HSSFCellStyle"); | |||
} | |||
%typemap(out) jhcellstyle { | |||
$result = jo2rv($1, $descriptor(org::apache::poi::hssf::usermodel::HSSFCellStyle *)); | |||
} | |||
%typemap(in) jhdataformat{ | |||
if (!rv2jo($input, (jobject *) &$1, | |||
$descriptor(org::apache::poi::hssf::usermodel::HSSFDataFormat *))) | |||
rb_raise(rb_eRuntimeError, "Unrecoverable error in SWIG typemapping of HSSFDataFormat"); | |||
} | |||
%typemap(out) jhdataformat { | |||
$result = jo2rv($1, $descriptor(org::apache::poi::hssf::usermodel::HSSFDataFormat *)); | |||
} | |||
%typemap(in) jstring { | |||
$1 = r2j($input); | |||
} | |||
%typemap(out) jstring { | |||
$result = j2r($1); | |||
} | |||
%typecheck(SWIG_TYPECHECK_STRING) jstring { | |||
$1 = ( NIL_P($input) || TYPE($input)==T_STRING ); | |||
} | |||
%typemap(in) joutputstream { | |||
jlong ptr; | |||
if (!rb_respond_to($input, rb_intern("putc"))) rb_raise(rb_eTypeError,"Expected IO"); | |||
*(VALUE *) &ptr = (VALUE) $input; | |||
$1 = new org::apache::poi::RubyOutputStream(ptr); | |||
} | |||
%typemap(in) jcalendar { | |||
$1 = java::util::Calendar::getInstance(); | |||
//$1->setTimeInMillis((long long) NUM2DBL(rb_funcall($input,rb_intern("to_i"),0,NULL))*1000.0); | |||
$1->set(FIX2INT(rb_funcall($input,rb_intern("year"),0,NULL)), | |||
FIX2INT(rb_funcall($input,rb_intern("mon"),0,NULL))-1, | |||
FIX2INT(rb_funcall($input,rb_intern("day"),0,NULL)), | |||
FIX2INT(rb_funcall($input,rb_intern("hour"),0,NULL)), | |||
FIX2INT(rb_funcall($input,rb_intern("min"),0,NULL)), | |||
FIX2INT(rb_funcall($input,rb_intern("sec"),0,NULL)) | |||
); | |||
} | |||
%typecheck(SWIG_TYPECHECK_POINTER) jcalendar { | |||
$1 = rb_respond_to($input, rb_intern("asctime")); | |||
} | |||
%typemap(out) jdate { | |||
jlong t = ((jdate) $1)->getTime(); | |||
//TODO: separate seconds and microsecs | |||
int ts=t/1000; | |||
$result=rb_time_new((time_t) ts, 0 ); | |||
} | |||
%freefunc org::apache::poi::hssf::usermodel::HSSFWorkbook "free_java_obj"; | |||
%exception { | |||
try { | |||
$action | |||
} catch (java::lang::Throwable *e) { | |||
raise_ruby_error(e); | |||
} | |||
} | |||
%exception org::apache::poi::hssf::usermodel::HSSFWorkbook::HSSFWorkbook { | |||
try { | |||
$action | |||
store_reference(result); | |||
} catch (java::lang::Throwable *e) { | |||
raise_ruby_error(e); | |||
} | |||
} | |||
namespace java { | |||
namespace lang { | |||
class Object { | |||
jstring toString(); | |||
}; | |||
%nodefault; | |||
class System : public Object { | |||
public: | |||
static jstring getProperty(jstring); | |||
static jstring getProperty(jstring, jstring); | |||
static void load(jstring); | |||
static void loadLibrary(jstring); | |||
static void mapLibraryName(jstring); | |||
static void runFinalization(); | |||
static void setProperty(jstring, jstring); | |||
}; | |||
%makedefault; | |||
} | |||
namespace io { | |||
%nodefault; | |||
class InputStream : public ::java::lang::Object { | |||
}; | |||
class OutputStream : public ::java::lang::Object { | |||
}; | |||
%makedefault; | |||
} | |||
namespace util { | |||
class Date : public ::java::lang::Object { | |||
public: | |||
Date(); | |||
Date(jlong); | |||
void setTime(jlong); | |||
jstring toString(); | |||
}; | |||
} | |||
} | |||
namespace org { | |||
namespace apache { | |||
namespace poi { | |||
namespace hssf { | |||
namespace usermodel { | |||
%nodefault; | |||
class HSSFWorkbook : public ::java::lang::Object { | |||
public: | |||
HSSFWorkbook(); | |||
jstring getSheetName(jint); | |||
jint getNumberOfSheets(); | |||
void setSheetOrder(jstring,jint); | |||
void setSheetName(jint,jstring); | |||
void setSheetName(jint,jstring,jshort); | |||
jint getSheetIndex(jstring); | |||
jhsheet createSheet(); | |||
jhsheet cloneSheet(jint); | |||
jhsheet createSheet(jstring); | |||
jhsheet getSheetAt(jint); | |||
jhsheet getSheet(jstring); | |||
void removeSheetAt(jint); | |||
jhcellstyle createCellStyle(); | |||
jhfont createFont(); | |||
jhdataformat createDataFormat(); | |||
void write(joutputstream); | |||
}; | |||
class HSSFSheet : public ::java::lang::Object { | |||
public: | |||
jhrow createRow(jint); | |||
jhrow getRow(jint); | |||
jhfooter getFooter(); | |||
jhheader getHeader(); | |||
}; | |||
class HSSFRow : public ::java::lang::Object { | |||
public: | |||
jhcell createCell(jshort); | |||
jhcell getCell(jshort); | |||
//jboolean getProtect(); //only in 2.5 | |||
}; | |||
class HSSFCell : public ::java::lang::Object { | |||
public: | |||
void setCellValue(jdouble); | |||
void setCellValue(jstring); | |||
void setCellValue(jboolean); | |||
void setCellValue(jcalendar); | |||
void setCellFormula(jstring); | |||
jstring getStringCellValue(); | |||
jdouble getNumericCellValue(); | |||
jdate getDateCellValue(); | |||
jstring getCellFormula(); | |||
jboolean getBooleanCellValue(); | |||
jint getCellType(); | |||
jshort getEncoding(); | |||
void setAsActiveCell(); | |||
void setCellStyle(jhcellstyle); | |||
void setEncoding(jshort encoding); | |||
static const jint CELL_TYPE_BLANK; | |||
static const jint CELL_TYPE_BOOLEAN; | |||
static const jint CELL_TYPE_ERROR; | |||
static const jint CELL_TYPE_FORMULA; | |||
static const jint CELL_TYPE_NUMERIC; | |||
static const jint CELL_TYPE_STRING; | |||
static const jshort ENCODING_COMPRESSED_UNICODE; | |||
static const jshort ENCODING_UTF_16; | |||
}; | |||
class HSSFCellStyle : public ::java::lang::Object { | |||
public: | |||
static const jshort ALIGN_CENTER; | |||
static const jshort ALIGN_CENTER_SELECTION; | |||
static const jshort ALIGN_FILL; | |||
static const jshort ALIGN_GENERAL; | |||
static const jshort ALIGN_JUSTIFY; | |||
static const jshort ALIGN_LEFT; | |||
static const jshort ALIGN_RIGHT; | |||
static const jshort ALT_BARS; | |||
static const jshort BIG_SPOTS; | |||
static const jshort BORDER_DASH_DOT; | |||
static const jshort BORDER_DASH_DOT_DOT; | |||
static const jshort BORDER_DASHED; | |||
static const jshort BORDER_DOTTED; | |||
static const jshort BORDER_DOUBLE; | |||
static const jshort BORDER_HAIR; | |||
static const jshort BORDER_MEDIUM; | |||
static const jshort BORDER_MEDIUM_DASH_DOT; | |||
static const jshort BORDER_MEDIUM_DASH_DOT_DOT; | |||
static const jshort BORDER_MEDIUM_DASHED; | |||
static const jshort BORDER_NONE; | |||
static const jshort BORDER_SLANTED_DASH_DOT; | |||
static const jshort BORDER_THICK; | |||
static const jshort BORDER_THIN; | |||
static const jshort BRICKS; | |||
static const jshort DIAMONDS; | |||
static const jshort FINE_DOTS; | |||
static const jshort NO_FILL; | |||
static const jshort SOLID_FOREGROUND; | |||
static const jshort SPARSE_DOTS; | |||
static const jshort SQUARES; | |||
static const jshort THICK_BACKWARD_DIAG; | |||
static const jshort THICK_FORWARD_DIAG; | |||
static const jshort THICK_HORZ_BANDS; | |||
static const jshort THICK_VERT_BANDS; | |||
static const jshort THIN_BACKWARD_DIAG; | |||
static const jshort THIN_FORWARD_DIAG; | |||
static const jshort THIN_HORZ_BANDS; | |||
static const jshort THIN_VERT_BANDS; | |||
static const jshort VERTICAL_BOTTOM; | |||
static const jshort VERTICAL_CENTER; | |||
static const jshort VERTICAL_JUSTIFY; | |||
static const jshort VERTICAL_TOP; | |||
jshort getAlignment(); | |||
jshort getBorderBottom(); | |||
jshort getBorderLeft(); | |||
jshort getBorderRight(); | |||
jshort getBorderTop(); | |||
jshort getBottomBorderColor(); | |||
jshort getDataFormat(); | |||
jshort getFillBackgroundColor(); | |||
jshort getFillForegroundColor(); | |||
jshort getFillPattern(); | |||
jshort getFontIndex(); | |||
jboolean getHidden(); | |||
jshort getIndention(); | |||
jshort getIndex(); | |||
jshort getLeftBorderColor(); | |||
jboolean getLocked(); | |||
jshort getRightBorderColor(); | |||
jshort getRotation(); | |||
jshort getTopBorderColor(); | |||
jshort getVerticalAlignment(); | |||
jboolean getWrapText(); | |||
void setAlignment(jshort) ; | |||
void setBorderBottom(jshort ); | |||
void setBorderLeft(jshort ); | |||
void setBorderRight(jshort ); | |||
void setBorderTop(jshort ); | |||
void setBottomBorderColor(jshort ); | |||
void setDataFormat(jshort ); | |||
void setFillBackgroundColor(jshort ); | |||
void setFillForegroundColor(jshort ); | |||
void setFillPattern(jshort ); | |||
void setFont(jhfont ); | |||
void setHidden(jboolean ); | |||
void setIndention(jshort ); | |||
void setLeftBorderColor(jshort ); | |||
void setLocked(jboolean ); | |||
void setRightBorderColor(jshort ); | |||
void setRotation(jshort ); | |||
void setTopBorderColor(jshort ); | |||
void setVerticalAlignment(jshort ); | |||
void setWrapText(jboolean ); | |||
}; | |||
class HSSFDataFormat : public ::java::lang::Object { | |||
public: | |||
static jstring getBuiltinFormat(jshort); | |||
static jshort getBuiltinFormat(jstring); | |||
jstring getFormat(jshort); | |||
jshort getFormat(jstring); | |||
static jint getNumberOfBuiltinBuiltinFormats(); | |||
//TODO static jlist getBuiltinFormats(); | |||
}; | |||
class HSSFFont : public ::java::lang::Object { | |||
public: | |||
static const jshort BOLDWEIGHT_BOLD; | |||
static const jshort BOLDWEIGHT_NORMAL; | |||
static const jshort COLOR_NORMAL; | |||
static const jshort COLOR_RED; | |||
static const jstring FONT_ARIAL; | |||
static const jshort SS_NONE; | |||
static const jshort SS_SUB; | |||
static const jshort SS_SUPER; | |||
static const jshort U_DOUBLE; | |||
static const jshort U_DOUBLE_ACCOUNTING; | |||
static const jshort U_NONE; | |||
static const jshort U_SINGLE; | |||
static const jshort U_SINGLE_ACCOUNTING; | |||
jshort getBoldweight(); | |||
jshort getColor(); | |||
jshort getFontHeight(); | |||
jshort getFontHeightInPoints(); | |||
jstring getFontName(); | |||
jshort getIndex(); | |||
jboolean getItalic(); | |||
jboolean getStrikeout(); | |||
jshort getTypeOffset(); | |||
jshort getUnderline(); | |||
void setBoldweight(jshort ); | |||
void setColor(jshort ); | |||
void setFontHeight(jshort ); | |||
void setFontHeightInPoints(jshort ); | |||
void setFontName(jstring ); | |||
void setItalic(jboolean ); | |||
void setStrikeout(jboolean ); | |||
void setTypeOffset(jshort ); | |||
void setUnderline(jshort ); | |||
}; | |||
%makedefault; | |||
} | |||
} | |||
} | |||
} | |||
} | |||
%init %{ | |||
JvCreateJavaVM(NULL); | |||
JvAttachCurrentThread(NULL, NULL); | |||
nextThread = new java::lang::Thread(); | |||
objects = new java::util::HashMap(); | |||
java::util::HashMap *props = (java::util::HashMap *) | |||
java::lang::System::getProperties(); | |||
props->put(JvNewStringUTF("inRuby"), objects); | |||
JvInitClass(&org::apache::poi::hssf::usermodel::HSSFFont::class$); | |||
JvInitClass(&org::apache::poi::hssf::usermodel::HSSFCell::class$); | |||
JvInitClass(&org::apache::poi::hssf::usermodel::HSSFSheet::class$); | |||
JvInitClass(&org::apache::poi::hssf::usermodel::HSSFCellStyle::class$); | |||
%} | |||
@@ -1,44 +0,0 @@ | |||
/* ==================================================================== | |||
Licensed to the Apache Software Foundation (ASF) under one or more | |||
contributor license agreements. See the NOTICE file distributed with | |||
this work for additional information regarding copyright ownership. | |||
The ASF licenses this file to You under the Apache License, Version 2.0 | |||
(the "License"); you may not use this file except in compliance with | |||
the License. You may obtain a copy of the License at | |||
http://www.apache.org/licenses/LICENSE-2.0 | |||
Unless required by applicable law or agreed to in writing, software | |||
distributed under the License is distributed on an "AS IS" BASIS, | |||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | |||
See the License for the specific language governing permissions and | |||
limitations under the License. | |||
==================================================================== */ | |||
#include <gcj/cni.h> | |||
#include "ruby.h" | |||
#include "org/apache/poi/RubyOutputStream.h" | |||
/** | |||
* The native functions declared in org.apache.poi.RubyoutputStream | |||
* | |||
* @author aviks | |||
*/ | |||
namespace org { | |||
namespace apache { | |||
namespace poi { | |||
void RubyOutputStream::close(void) | |||
{ | |||
rb_funcall3((VALUE ) rubyIO, rb_intern("close"), 0, NULL); | |||
} | |||
void RubyOutputStream::write(jint toWrite) | |||
{ | |||
rb_funcall((VALUE ) rubyIO, rb_intern("putc"),1,INT2FIX(toWrite)); | |||
} | |||
} | |||
} | |||
} |
@@ -1,62 +0,0 @@ | |||
/* ==================================================================== | |||
Licensed to the Apache Software Foundation (ASF) under one or more | |||
contributor license agreements. See the NOTICE file distributed with | |||
this work for additional information regarding copyright ownership. | |||
The ASF licenses this file to You under the Apache License, Version 2.0 | |||
(the "License"); you may not use this file except in compliance with | |||
the License. You may obtain a copy of the License at | |||
http://www.apache.org/licenses/LICENSE-2.0 | |||
Unless required by applicable law or agreed to in writing, software | |||
distributed under the License is distributed on an "AS IS" BASIS, | |||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | |||
See the License for the specific language governing permissions and | |||
limitations under the License. | |||
==================================================================== */ | |||
package org.apache.poi; | |||
import java.io.OutputStream; | |||
import java.io.IOException; | |||
/** | |||
* @author aviks | |||
* Wrap a java.io.OutputStream around a Ruby IO object | |||
*/ | |||
public class RubyOutputStream extends OutputStream { | |||
//pointer to native ruby VALUE | |||
protected long rubyIO; | |||
public RubyOutputStream (long rubyIO) | |||
{ | |||
this.rubyIO = rubyIO; | |||
// incRef(); | |||
} | |||
@Override | |||
protected void finalize() | |||
throws Throwable | |||
{ | |||
// decRef(); | |||
} | |||
// protected native void incRef(); | |||
// protected native void decRef(); | |||
@Override | |||
public native void close() | |||
throws IOException; | |||
/* (non-Javadoc) | |||
* @see java.io.OutputStream#write(int) | |||
*/ | |||
@Override | |||
public native void write(int arg0) throws IOException; | |||
} | |||
@@ -1,100 +0,0 @@ | |||
# ==================================================================== | |||
# Licensed to the Apache Software Foundation (ASF) under one or more | |||
# contributor license agreements. See the NOTICE file distributed with | |||
# this work for additional information regarding copyright ownership. | |||
# The ASF licenses this file to You under the Apache License, Version 2.0 | |||
# (the "License"); you may not use this file except in compliance with | |||
# the License. You may obtain a copy of the License at | |||
# | |||
# http://www.apache.org/licenses/LICENSE-2.0 | |||
# | |||
# Unless required by applicable law or agreed to in writing, software | |||
# distributed under the License is distributed on an "AS IS" BASIS, | |||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | |||
# See the License for the specific language governing permissions and | |||
# limitations under the License. | |||
# ==================================================================== | |||
require 'test/unit' | |||
require 'release/poi4r' | |||
class TC_base_tests < Test::Unit::TestCase | |||
def setup() | |||
end | |||
def test_get_constant | |||
h=Poi4r::HSSFWorkbook.new | |||
s=h.createSheet("Sheet1") | |||
r=s.createRow(0) | |||
c=r.createCell(0) | |||
assert_equal(3,Poi4r::HSSFCell.CELL_TYPE_BLANK,"Constant CELL_TYPE_BLANK") | |||
end | |||
def test_base | |||
system("rm test.xls") | |||
h=Poi4r::HSSFWorkbook.new | |||
#Test Sheet Creation | |||
s=h.createSheet("Sheet1") | |||
s=h.createSheet("Sheet2") | |||
assert_equal(2,h.getNumberOfSheets(),"Number of sheets is 2") | |||
#Test setting cell values | |||
s=h.getSheetAt(0) | |||
r=s.createRow(0) | |||
c=r.createCell(0) | |||
c.setCellValue(1.5) | |||
assert_equal(c.getNumericCellValue(),1.5,"Numeric Cell Value") | |||
c=r.createCell(1) | |||
c.setCellValue("Ruby") | |||
assert_equal(c.getStringCellValue(),"Ruby","String Cell Value") | |||
#Test error handling | |||
assert_raise (RuntimeError) {c.getNumericCellValue()} | |||
#Test styles | |||
st = h.createCellStyle() | |||
c=r.createCell(2) | |||
st.setAlignment(Poi4r::HSSFCellStyle.ALIGN_CENTER) | |||
c.setCellStyle(st) | |||
c.setCellValue("centr'd") | |||
#Date handling | |||
c=r.createCell(3) | |||
t1=Time.now | |||
c.setCellValue(Time.now) | |||
t2= c.getDateCellValue().gmtime | |||
assert_equal(t1.year,t2.year,"year") | |||
assert_equal(t1.mon,t2.mon,"month") | |||
assert_equal(t1.day,t2.day,"day") | |||
assert_equal(t1.hour,t2.hour,"hour") | |||
assert_equal(t1.min,t2.min,"min") | |||
assert_equal(t1.sec,t2.sec,"sec") | |||
st=h.createCellStyle(); | |||
st.setDataFormat(Poi4r::HSSFDataFormat.getBuiltinFormat("m/d/yy h:mm")) | |||
c.setCellStyle(st) | |||
#Fonts | |||
c=r.createCell(4) | |||
font = h.createFont(); | |||
font.setFontHeightInPoints(24); | |||
font.setFontName("Courier New"); | |||
font.setItalic(true); | |||
font.setStrikeout(true); | |||
style = h.createCellStyle(); | |||
style.setFont(font); | |||
c.setCellValue("This is a test of fonts"); | |||
c.setCellStyle(style); | |||
#Formulas | |||
c=r.createCell(5) | |||
c.setCellFormula("A1*2") | |||
assert_equal("A1*2",c.getCellFormula,"formula") | |||
#Test writing | |||
h.write(File.new("test.xls","w")) | |||
assert_nothing_raised {File.new("test.xls","r")} | |||
#h.write(0.1) | |||
end | |||
end |
@@ -1,32 +0,0 @@ | |||
# ==================================================================== | |||
# Licensed to the Apache Software Foundation (ASF) under one or more | |||
# contributor license agreements. See the NOTICE file distributed with | |||
# this work for additional information regarding copyright ownership. | |||
# The ASF licenses this file to You under the Apache License, Version 2.0 | |||
# (the "License"); you may not use this file except in compliance with | |||
# the License. You may obtain a copy of the License at | |||
# | |||
# http://www.apache.org/licenses/LICENSE-2.0 | |||
# | |||
# Unless required by applicable law or agreed to in writing, software | |||
# distributed under the License is distributed on an "AS IS" BASIS, | |||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | |||
# See the License for the specific language governing permissions and | |||
# limitations under the License. | |||
# ==================================================================== | |||
require 'test/unit' | |||
require 'release/poi4r' | |||
class TC_gc < Test::Unit::TestCase | |||
def test_premature_collection | |||
h=Poi4r::HSSFWorkbook.new | |||
h.createSheet("Sheet1"); | |||
5000.times do | |||
hh=Poi4r::HSSFWorkbook.new | |||
GC.start() | |||
end | |||
assert_equal(1,h.getNumberOfSheets(),"Number of sheets") | |||
end | |||
end | |||
@@ -1,20 +0,0 @@ | |||
# ==================================================================== | |||
# Licensed to the Apache Software Foundation (ASF) under one or more | |||
# contributor license agreements. See the NOTICE file distributed with | |||
# this work for additional information regarding copyright ownership. | |||
# The ASF licenses this file to You under the Apache License, Version 2.0 | |||
# (the "License"); you may not use this file except in compliance with | |||
# the License. You may obtain a copy of the License at | |||
# | |||
# http://www.apache.org/licenses/LICENSE-2.0 | |||
# | |||
# Unless required by applicable law or agreed to in writing, software | |||
# distributed under the License is distributed on an "AS IS" BASIS, | |||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | |||
# See the License for the specific language governing permissions and | |||
# limitations under the License. | |||
# ==================================================================== | |||
require 'test/unit' | |||
require 'tests/tc_base_tests' | |||
require 'tests/tc_gc' |
@@ -1,116 +0,0 @@ | |||
<!-- | |||
Licensed to the Apache Software Foundation (ASF) under one or more | |||
contributor license agreements. See the NOTICE file distributed with | |||
this work for additional information regarding copyright ownership. | |||
The ASF licenses this file to You under the Apache License, Version 2.0 | |||
(the "License"); you may not use this file except in compliance with | |||
the License. You may obtain a copy of the License at | |||
http://www.apache.org/licenses/LICENSE-2.0 | |||
Unless required by applicable law or agreed to in writing, software | |||
distributed under the License is distributed on an "AS IS" BASIS, | |||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | |||
See the License for the specific language governing permissions and | |||
limitations under the License. | |||
--> | |||
<%@page contentType="text/html" | |||
import="java.io.*,org.apache.poi.poifs.filesystem.POIFSFileSystem,org.apache.poi | |||
.hssf.record.*,org.apache.poi.hssf.model.*,org.apache.poi.hssf.usermodel.*,org.a | |||
pache.poi.hssf.util.*" %> | |||
<html> | |||
<head><title>Read Excel file </title> | |||
</head> | |||
<body> | |||
An example of using Jakarta POI's HSSF package to read an excel spreadsheet: | |||
<form name="form1" method="get" action=""> | |||
Select an Excel file to read. | |||
<input type="file" name="xls_filename" onChange="form1.submit()"> | |||
</form> | |||
<% | |||
String filename = request.getParameter("xls_filename"); | |||
if (filename != null && !filename.equals("")) { | |||
%> | |||
<br>You chose the file <%= filename %>. | |||
<br><br>It's contents are: | |||
<% | |||
try | |||
{ | |||
// create a poi workbook from the excel spreadsheet file | |||
POIFSFileSystem fs = | |||
new POIFSFileSystem(new FileInputStream(filename)); | |||
HSSFWorkbook wb = new HSSFWorkbook(fs); | |||
for (int k = 0; k < wb.getNumberOfSheets(); k++) | |||
{ | |||
%> | |||
<br><br>Sheet <%= k %> <br> | |||
<% | |||
HSSFSheet sheet = wb.getSheetAt(k); | |||
int rows = sheet.getPhysicalNumberOfRows(); | |||
for (int r = 0; r < rows; r++) | |||
{ | |||
HSSFRow row = sheet.getRow(r); | |||
if (row != null) { | |||
int cells = row.getPhysicalNumberOfCells(); | |||
%> | |||
<br><b>ROW <%= | |||
row.getRowNum() %> </b> | |||
<% | |||
for (short c = 0; c < cells; c++) | |||
{ | |||
HSSFCell cell = row.getCell(c); | |||
if (cell != null) { | |||
String value = null; | |||
switch (cell.getCellType()) | |||
{ | |||
case HSSFCell.CELL_TYPE_FORMULA : | |||
value = "FORMULA "; | |||
break; | |||
case HSSFCell.CELL_TYPE_NUMERIC : | |||
value = "NUMERIC value=" | |||
+ cell.getNumericCellValue | |||
(); | |||
break; | |||
case HSSFCell.CELL_TYPE_STRING : | |||
value = "STRING value=" | |||
+ cell.getStringCellValue(); | |||
break; | |||
default : | |||
} | |||
%> | |||
<%= "CELL col=" | |||
+ cell.getColumnIndex() | |||
+ " VALUE=" + value %> | |||
<% | |||
} | |||
} | |||
} | |||
} | |||
} | |||
} | |||
catch (Exception e) | |||
{ | |||
%> | |||
Error occurred: <%= e.getMessage() %> | |||
<% | |||
e.printStackTrace(); | |||
} | |||
} | |||
%> | |||
</body> | |||
</html> | |||
@@ -1 +0,0 @@ | |||
Dummy file so this directory is not deleted by CVS. It's required for the build. |
@@ -1,46 +0,0 @@ | |||
/* | |||
* ==================================================================== | |||
* Licensed to the Apache Software Foundation (ASF) under one or more | |||
* contributor license agreements. See the NOTICE file distributed with | |||
* this work for additional information regarding copyright ownership. | |||
* The ASF licenses this file to You under the Apache License, Version 2.0 | |||
* (the "License"); you may not use this file except in compliance with | |||
* the License. You may obtain a copy of the License at | |||
* | |||
* http://www.apache.org/licenses/LICENSE-2.0 | |||
* | |||
* Unless required by applicable law or agreed to in writing, software | |||
* distributed under the License is distributed on an "AS IS" BASIS, | |||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | |||
* See the License for the specific language governing permissions and | |||
* limitations under the License. | |||
* ==================================================================== | |||
*/ | |||
package org.apache.poi.crypt.examples; | |||
import java.io.InputStream; | |||
import org.apache.poi.poifs.crypt.Decryptor; | |||
import org.apache.poi.poifs.crypt.EncryptionInfo; | |||
import org.apache.poi.poifs.filesystem.POIFSFileSystem; | |||
import org.apache.poi.util.IOUtils; | |||
public class EncryptionUtils { | |||
private EncryptionUtils() { | |||
} | |||
public static InputStream decrypt(final InputStream inputStream, final String pwd) throws Exception { | |||
try { | |||
POIFSFileSystem fs = new POIFSFileSystem(inputStream); | |||
EncryptionInfo info = new EncryptionInfo(fs); | |||
Decryptor d = Decryptor.getInstance(info); | |||
if (!d.verifyPassword(pwd)) { | |||
throw new RuntimeException("incorrect password"); | |||
} | |||
return d.getDataStream(fs); | |||
} finally { | |||
IOUtils.closeQuietly(inputStream); | |||
} | |||
} | |||
} |
@@ -1,46 +0,0 @@ | |||
/* | |||
* ==================================================================== | |||
* Licensed to the Apache Software Foundation (ASF) under one or more | |||
* contributor license agreements. See the NOTICE file distributed with | |||
* this work for additional information regarding copyright ownership. | |||
* The ASF licenses this file to You under the Apache License, Version 2.0 | |||
* (the "License"); you may not use this file except in compliance with | |||
* the License. You may obtain a copy of the License at | |||
* | |||
* http://www.apache.org/licenses/LICENSE-2.0 | |||
* | |||
* Unless required by applicable law or agreed to in writing, software | |||
* distributed under the License is distributed on an "AS IS" BASIS, | |||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | |||
* See the License for the specific language governing permissions and | |||
* limitations under the License. | |||
* ==================================================================== | |||
*/ | |||
package org.apache.poi.examples.util; | |||
import java.io.File; | |||
import java.io.IOException; | |||
import org.apache.poi.util.TempFile; | |||
public class TempFileUtils { | |||
private TempFileUtils() { | |||
} | |||
public static void checkTempFiles() throws IOException { | |||
String tmpDir = System.getProperty(TempFile.JAVA_IO_TMPDIR) + "/poifiles"; | |||
File tempDir = new File(tmpDir); | |||
if(tempDir.exists()) { | |||
String[] tempFiles = tempDir.list(); | |||
if(tempFiles != null && tempFiles.length > 0) { | |||
System.out.println("found files in poi temp dir " + tempDir.getAbsolutePath()); | |||
for(String filename : tempFiles) { | |||
System.out.println("file: " + filename); | |||
} | |||
} | |||
} else { | |||
System.out.println("unable to find poi temp dir"); | |||
} | |||
} | |||
} |
@@ -1,503 +0,0 @@ | |||
/* ==================================================================== | |||
Licensed to the Apache Software Foundation (ASF) under one or more | |||
contributor license agreements. See the NOTICE file distributed with | |||
this work for additional information regarding copyright ownership. | |||
The ASF licenses this file to You under the Apache License, Version 2.0 | |||
(the "License"); you may not use this file except in compliance with | |||
the License. You may obtain a copy of the License at | |||
http://www.apache.org/licenses/LICENSE-2.0 | |||
Unless required by applicable law or agreed to in writing, software | |||
distributed under the License is distributed on an "AS IS" BASIS, | |||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | |||
See the License for the specific language governing permissions and | |||
limitations under the License. | |||
==================================================================== */ | |||
package org.apache.poi.hpsf.examples; | |||
import java.io.ByteArrayInputStream; | |||
import java.io.ByteArrayOutputStream; | |||
import java.io.File; | |||
import java.io.FileInputStream; | |||
import java.io.FileNotFoundException; | |||
import java.io.FileOutputStream; | |||
import java.io.IOException; | |||
import java.io.InputStream; | |||
import java.io.OutputStream; | |||
import java.io.UnsupportedEncodingException; | |||
import java.util.HashMap; | |||
import java.util.Map; | |||
import org.apache.poi.hpsf.HPSFRuntimeException; | |||
import org.apache.poi.hpsf.MarkUnsupportedException; | |||
import org.apache.poi.hpsf.MutablePropertySet; | |||
import org.apache.poi.hpsf.NoPropertySetStreamException; | |||
import org.apache.poi.hpsf.PropertySet; | |||
import org.apache.poi.hpsf.PropertySetFactory; | |||
import org.apache.poi.hpsf.Util; | |||
import org.apache.poi.hpsf.WritingNotSupportedException; | |||
import org.apache.poi.poifs.eventfilesystem.POIFSReader; | |||
import org.apache.poi.poifs.eventfilesystem.POIFSReaderEvent; | |||
import org.apache.poi.poifs.eventfilesystem.POIFSReaderListener; | |||
import org.apache.poi.poifs.filesystem.DirectoryEntry; | |||
import org.apache.poi.poifs.filesystem.DocumentEntry; | |||
import org.apache.poi.poifs.filesystem.DocumentInputStream; | |||
import org.apache.poi.poifs.filesystem.Entry; | |||
import org.apache.poi.poifs.filesystem.POIFSDocumentPath; | |||
import org.apache.poi.poifs.filesystem.POIFSFileSystem; | |||
import org.apache.poi.util.TempFile; | |||
/** | |||
* <p>This class copies a POI file system to a new file and compares the copy | |||
* with the original.</p> | |||
* | |||
* <p>Property set streams are copied logically, i.e. the application | |||
* establishes a {@link org.apache.poi.hpsf.PropertySet} of an original property | |||
* set, creates a {@link org.apache.poi.hpsf.MutablePropertySet} from the | |||
* {@link org.apache.poi.hpsf.PropertySet} and writes the | |||
* {@link org.apache.poi.hpsf.MutablePropertySet} to the destination POI file | |||
* system. - Streams which are no property set streams are copied bit by | |||
* bit.</p> | |||
* | |||
* <p>The comparison of the POI file systems is done logically. That means that | |||
* the two disk files containing the POI file systems do not need to be | |||
* exactly identical. However, both POI file systems must contain the same | |||
* files, and most of these files must be bitwise identical. Property set | |||
* streams, however, are compared logically: they must have the same sections | |||
* with the same attributs, and the sections must contain the same properties. | |||
* Details like the ordering of the properties do not matter.</p> | |||
*/ | |||
public class CopyCompare | |||
{ | |||
/** | |||
* <p>Runs the example program. The application expects one or two | |||
* arguments:</p> | |||
* | |||
* <ol> | |||
* | |||
* <li><p>The first argument is the disk file name of the POI filesystem to | |||
* copy.</p></li> | |||
* | |||
* <li><p>The second argument is optional. If it is given, it is the name of | |||
* a disk file the copy of the POI filesystem will be written to. If it is | |||
* not given, the copy will be written to a temporary file which will be | |||
* deleted at the end of the program.</p></li> | |||
* | |||
* </ol> | |||
* | |||
* @param args Command-line arguments. | |||
* @exception MarkUnsupportedException if a POI document stream does not | |||
* support the mark() operation. | |||
* @exception NoPropertySetStreamException if the application tries to | |||
* create a property set from a POI document stream that is not a property | |||
* set stream. | |||
* @exception IOException if any I/O exception occurs. | |||
* @exception UnsupportedEncodingException if a character encoding is not | |||
* supported. | |||
*/ | |||
public static void main(final String[] args) | |||
throws NoPropertySetStreamException, MarkUnsupportedException, | |||
UnsupportedEncodingException, IOException | |||
{ | |||
String originalFileName = null; | |||
String copyFileName = null; | |||
/* Check the command-line arguments. */ | |||
if (args.length == 1) { | |||
originalFileName = args[0]; | |||
File f = TempFile.createTempFile("CopyOfPOIFileSystem-", ".ole2"); | |||
f.deleteOnExit(); | |||
copyFileName = f.getAbsolutePath(); | |||
} else if (args.length == 2) { | |||
originalFileName = args[0]; | |||
copyFileName = args[1]; | |||
} else { | |||
System.err.println("Usage: " + CopyCompare.class.getName() + | |||
"originPOIFS [copyPOIFS]"); | |||
System.exit(1); | |||
} | |||
/* Read the origin POIFS using the eventing API. The real work is done | |||
* in the class CopyFile which is registered here as a POIFSReader. */ | |||
final POIFSReader r = new POIFSReader(); | |||
final CopyFile cf = new CopyFile(copyFileName); | |||
r.registerListener(cf); | |||
FileInputStream fis = new FileInputStream(originalFileName); | |||
r.read(fis); | |||
fis.close(); | |||
/* Write the new POIFS to disk. */ | |||
cf.close(); | |||
/* Read all documents from the original POI file system and compare them | |||
* with the equivalent document from the copy. */ | |||
final POIFSFileSystem opfs = new POIFSFileSystem(new File(originalFileName)); | |||
final POIFSFileSystem cpfs = new POIFSFileSystem(new File(copyFileName)); | |||
final DirectoryEntry oRoot = opfs.getRoot(); | |||
final DirectoryEntry cRoot = cpfs.getRoot(); | |||
final StringBuffer messages = new StringBuffer(); | |||
if (equal(oRoot, cRoot, messages)) { | |||
System.out.println("Equal"); | |||
} else { | |||
System.out.println("Not equal: " + messages.toString()); | |||
} | |||
cpfs.close(); | |||
opfs.close(); | |||
} | |||
/** | |||
* <p>Compares two {@link DirectoryEntry} instances of a POI file system. | |||
* The directories must contain the same streams with the same names and | |||
* contents.</p> | |||
* | |||
* @param d1 The first directory. | |||
* @param d2 The second directory. | |||
* @param msg The method may append human-readable comparison messages to | |||
* this string buffer. | |||
* @return <code>true</code> if the directories are equal, else | |||
* <code>false</code>. | |||
* @exception MarkUnsupportedException if a POI document stream does not | |||
* support the mark() operation. | |||
* @exception NoPropertySetStreamException if the application tries to | |||
* create a property set from a POI document stream that is not a property | |||
* set stream. | |||
* @throws UnsupportedEncodingException | |||
* @exception IOException if any I/O exception occurs. | |||
*/ | |||
private static boolean equal(final DirectoryEntry d1, | |||
final DirectoryEntry d2, | |||
final StringBuffer msg) | |||
throws NoPropertySetStreamException, MarkUnsupportedException, | |||
UnsupportedEncodingException, IOException | |||
{ | |||
boolean equal = true; | |||
/* Iterate over d1 and compare each entry with its counterpart in d2. */ | |||
for (final Entry e1 : d1) { | |||
final String n1 = e1.getName(); | |||
Entry e2 = null; | |||
try { | |||
e2 = d2.getEntry(n1); | |||
} catch (FileNotFoundException ex) { | |||
msg.append("Document \"" + e1 + "\" exists, document \"" + | |||
e2 + "\" does not.\n"); | |||
equal = false; | |||
break; | |||
} | |||
if (e1.isDirectoryEntry() && e2.isDirectoryEntry()) { | |||
equal = equal((DirectoryEntry) e1, (DirectoryEntry) e2, msg); | |||
} else if (e1.isDocumentEntry() && e2.isDocumentEntry()) { | |||
equal = equal((DocumentEntry) e1, (DocumentEntry) e2, msg); | |||
} else { | |||
msg.append("One of \"" + e1 + "\" and \"" + e2 + "\" is a " + | |||
"document while the other one is a directory.\n"); | |||
equal = false; | |||
} | |||
} | |||
/* Iterate over d2 just to make sure that there are no entries in d2 | |||
* that are not in d1. */ | |||
for (final Entry e2 : d2) { | |||
final String n2 = e2.getName(); | |||
Entry e1 = null; | |||
try { | |||
e1 = d1.getEntry(n2); | |||
} catch (FileNotFoundException ex) { | |||
msg.append("Document \"" + e2 + "\" exitsts, document \"" + | |||
e1 + "\" does not.\n"); | |||
equal = false; | |||
break; | |||
} | |||
} | |||
return equal; | |||
} | |||
/** | |||
* <p>Compares two {@link DocumentEntry} instances of a POI file system. | |||
* Documents that are not property set streams must be bitwise identical. | |||
* Property set streams must be logically equal.</p> | |||
* | |||
* @param d1 The first document. | |||
* @param d2 The second document. | |||
* @param msg The method may append human-readable comparison messages to | |||
* this string buffer. | |||
* @return <code>true</code> if the documents are equal, else | |||
* <code>false</code>. | |||
* @exception MarkUnsupportedException if a POI document stream does not | |||
* support the mark() operation. | |||
* @exception NoPropertySetStreamException if the application tries to | |||
* create a property set from a POI document stream that is not a property | |||
* set stream. | |||
* @throws UnsupportedEncodingException | |||
* @exception IOException if any I/O exception occurs. | |||
*/ | |||
private static boolean equal(final DocumentEntry d1, final DocumentEntry d2, | |||
final StringBuffer msg) | |||
throws NoPropertySetStreamException, MarkUnsupportedException, | |||
UnsupportedEncodingException, IOException | |||
{ | |||
boolean equal = true; | |||
final DocumentInputStream dis1 = new DocumentInputStream(d1); | |||
final DocumentInputStream dis2 = new DocumentInputStream(d2); | |||
try { | |||
if (PropertySet.isPropertySetStream(dis1) && | |||
PropertySet.isPropertySetStream(dis2)) { | |||
final PropertySet ps1 = PropertySetFactory.create(dis1); | |||
final PropertySet ps2 = PropertySetFactory.create(dis2); | |||
equal = ps1.equals(ps2); | |||
if (!equal) { | |||
msg.append("Property sets are not equal.\n"); | |||
return equal; | |||
} | |||
} else { | |||
int i1; | |||
int i2; | |||
do { | |||
i1 = dis1.read(); | |||
i2 = dis2.read(); | |||
if (i1 != i2) { | |||
equal = false; | |||
msg.append("Documents are not equal.\n"); | |||
break; | |||
} | |||
} while (equal && i1 == -1); | |||
} | |||
} finally { | |||
dis2.close(); | |||
dis1.close(); | |||
} | |||
return true; | |||
} | |||
/** | |||
* <p>This class does all the work. Its method {@link | |||
* #processPOIFSReaderEvent(POIFSReaderEvent)} is called for each file in | |||
* the original POI file system. Except for property set streams it copies | |||
* everything unmodified to the destination POI filesystem. Property set | |||
* streams are copied by creating a new {@link PropertySet} from the | |||
* original property set by using the {@link | |||
* MutablePropertySet#MutablePropertySet(PropertySet)} constructor.</p> | |||
*/ | |||
static class CopyFile implements POIFSReaderListener { | |||
String dstName; | |||
OutputStream out; | |||
POIFSFileSystem poiFs; | |||
/** | |||
* <p>The constructor of a {@link CopyFile} instance creates the target | |||
* POIFS. It also stores the name of the file the POIFS will be written | |||
* to once it is complete.</p> | |||
* | |||
* @param dstName The name of the disk file the destination POIFS is to | |||
* be written to. | |||
*/ | |||
public CopyFile(final String dstName) { | |||
this.dstName = dstName; | |||
poiFs = new POIFSFileSystem(); | |||
} | |||
/** | |||
* <p>The method is called by POI's eventing API for each file in the | |||
* origin POIFS.</p> | |||
*/ | |||
@Override | |||
public void processPOIFSReaderEvent(final POIFSReaderEvent event) { | |||
/* The following declarations are shortcuts for accessing the | |||
* "event" object. */ | |||
final POIFSDocumentPath path = event.getPath(); | |||
final String name = event.getName(); | |||
final DocumentInputStream stream = event.getStream(); | |||
Throwable t = null; | |||
try { | |||
/* Find out whether the current document is a property set | |||
* stream or not. */ | |||
if (PropertySet.isPropertySetStream(stream)) { | |||
/* Yes, the current document is a property set stream. | |||
* Let's create a PropertySet instance from it. */ | |||
PropertySet ps = null; | |||
try { | |||
ps = PropertySetFactory.create(stream); | |||
} catch (NoPropertySetStreamException ex) { | |||
/* This exception will not be thrown because we already | |||
* checked above. */ | |||
} | |||
/* Copy the property set to the destination POI file | |||
* system. */ | |||
copy(poiFs, path, name, ps); | |||
} else { | |||
/* No, the current document is not a property set stream. We | |||
* copy it unmodified to the destination POIFS. */ | |||
copy(poiFs, event.getPath(), event.getName(), stream); | |||
} | |||
} catch (MarkUnsupportedException ex) { | |||
t = ex; | |||
} catch (IOException ex) { | |||
t = ex; | |||
} catch (WritingNotSupportedException ex) { | |||
t = ex; | |||
} | |||
/* According to the definition of the processPOIFSReaderEvent method | |||
* we cannot pass checked exceptions to the caller. The following | |||
* lines check whether a checked exception occured and throws an | |||
* unchecked exception. The message of that exception is that of | |||
* the underlying checked exception. */ | |||
if (t != null) { | |||
throw new HPSFRuntimeException | |||
("Could not read file \"" + path + "/" + name + | |||
"\". Reason: " + Util.toString(t)); | |||
} | |||
} | |||
/** | |||
* <p>Writes a {@link PropertySet} to a POI filesystem.</p> | |||
* | |||
* @param poiFs The POI filesystem to write to. | |||
* @param path The file's path in the POI filesystem. | |||
* @param name The file's name in the POI filesystem. | |||
* @param ps The property set to write. | |||
* @throws WritingNotSupportedException | |||
* @throws IOException | |||
*/ | |||
public void copy(final POIFSFileSystem poiFs, | |||
final POIFSDocumentPath path, | |||
final String name, | |||
final PropertySet ps) | |||
throws WritingNotSupportedException, IOException { | |||
final DirectoryEntry de = getPath(poiFs, path); | |||
final MutablePropertySet mps = new MutablePropertySet(ps); | |||
de.createDocument(name, mps.toInputStream()); | |||
} | |||
/** | |||
* <p>Copies the bytes from a {@link DocumentInputStream} to a new | |||
* stream in a POI filesystem.</p> | |||
* | |||
* @param poiFs The POI filesystem to write to. | |||
* @param path The source document's path. | |||
* @param name The source document's name. | |||
* @param stream The stream containing the source document. | |||
* @throws IOException | |||
*/ | |||
public void copy(final POIFSFileSystem poiFs, | |||
final POIFSDocumentPath path, | |||
final String name, | |||
final DocumentInputStream stream) | |||
throws IOException { | |||
final DirectoryEntry de = getPath(poiFs, path); | |||
final ByteArrayOutputStream out = new ByteArrayOutputStream(); | |||
int c; | |||
while ((c = stream.read()) != -1) { | |||
out.write(c); | |||
} | |||
stream.close(); | |||
out.close(); | |||
final InputStream in = | |||
new ByteArrayInputStream(out.toByteArray()); | |||
de.createDocument(name, in); | |||
} | |||
/** | |||
* <p>Writes the POI file system to a disk file.</p> | |||
* | |||
* @throws FileNotFoundException | |||
* @throws IOException | |||
*/ | |||
public void close() throws FileNotFoundException, IOException { | |||
out = new FileOutputStream(dstName); | |||
poiFs.writeFilesystem(out); | |||
out.close(); | |||
} | |||
/** Contains the directory paths that have already been created in the | |||
* output POI filesystem and maps them to their corresponding | |||
* {@link org.apache.poi.poifs.filesystem.DirectoryNode}s. */ | |||
private final Map<String,DirectoryEntry> paths = new HashMap<String,DirectoryEntry>(); | |||
/** | |||
* <p>Ensures that the directory hierarchy for a document in a POI | |||
* fileystem is in place. When a document is to be created somewhere in | |||
* a POI filesystem its directory must be created first. This method | |||
* creates all directories between the POI filesystem root and the | |||
* directory the document should belong to which do not yet exist.</p> | |||
* | |||
* <p>Unfortunately POI does not offer a simple method to interrogate | |||
* the POIFS whether a certain child node (file or directory) exists in | |||
* a directory. However, since we always start with an empty POIFS which | |||
* contains the root directory only and since each directory in the | |||
* POIFS is created by this method we can maintain the POIFS's directory | |||
* hierarchy ourselves: The {@link DirectoryEntry} of each directory | |||
* created is stored in a {@link Map}. The directories' path names map | |||
* to the corresponding {@link DirectoryEntry} instances.</p> | |||
* | |||
* @param poiFs The POI filesystem the directory hierarchy is created | |||
* in, if needed. | |||
* @param path The document's path. This method creates those directory | |||
* components of this hierarchy which do not yet exist. | |||
* @return The directory entry of the document path's parent. The caller | |||
* should use this {@link DirectoryEntry} to create documents in it. | |||
*/ | |||
public DirectoryEntry getPath(final POIFSFileSystem poiFs, | |||
final POIFSDocumentPath path) { | |||
try { | |||
/* Check whether this directory has already been created. */ | |||
final String s = path.toString(); | |||
DirectoryEntry de = paths.get(s); | |||
if (de != null) | |||
/* Yes: return the corresponding DirectoryEntry. */ | |||
return de; | |||
/* No: We have to create the directory - or return the root's | |||
* DirectoryEntry. */ | |||
int l = path.length(); | |||
if (l == 0) { | |||
/* Get the root directory. It does not have to be created | |||
* since it always exists in a POIFS. */ | |||
de = poiFs.getRoot(); | |||
} else { | |||
/* Create a subordinate directory. The first step is to | |||
* ensure that the parent directory exists: */ | |||
de = getPath(poiFs, path.getParent()); | |||
/* Now create the target directory: */ | |||
de = de.createDirectory(path.getComponent | |||
(path.length() - 1)); | |||
} | |||
paths.put(s, de); | |||
return de; | |||
} catch (IOException ex) { | |||
/* This exception will be thrown if the directory already | |||
* exists. However, since we have full control about directory | |||
* creation we can ensure that this will never happen. */ | |||
ex.printStackTrace(System.err); | |||
throw new RuntimeException(ex.toString()); | |||
/* FIXME (2): Replace the previous line by the following once we | |||
* no longer need JDK 1.3 compatibility. */ | |||
// throw new RuntimeException(ex); | |||
} | |||
} | |||
} | |||
} |
@@ -1,173 +0,0 @@ | |||
/* ==================================================================== | |||
Licensed to the Apache Software Foundation (ASF) under one or more | |||
contributor license agreements. See the NOTICE file distributed with | |||
this work for additional information regarding copyright ownership. | |||
The ASF licenses this file to You under the Apache License, Version 2.0 | |||
(the "License"); you may not use this file except in compliance with | |||
the License. You may obtain a copy of the License at | |||
http://www.apache.org/licenses/LICENSE-2.0 | |||
Unless required by applicable law or agreed to in writing, software | |||
distributed under the License is distributed on an "AS IS" BASIS, | |||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | |||
See the License for the specific language governing permissions and | |||
limitations under the License. | |||
==================================================================== */ | |||
package org.apache.poi.hpsf.examples; | |||
import java.io.File; | |||
import java.io.FileNotFoundException; | |||
import java.io.IOException; | |||
import java.util.Date; | |||
import org.apache.poi.hpsf.CustomProperties; | |||
import org.apache.poi.hpsf.DocumentSummaryInformation; | |||
import org.apache.poi.hpsf.MarkUnsupportedException; | |||
import org.apache.poi.hpsf.NoPropertySetStreamException; | |||
import org.apache.poi.hpsf.PropertySetFactory; | |||
import org.apache.poi.hpsf.SummaryInformation; | |||
import org.apache.poi.hpsf.UnexpectedPropertySetTypeException; | |||
import org.apache.poi.hpsf.WritingNotSupportedException; | |||
import org.apache.poi.poifs.filesystem.DirectoryEntry; | |||
import org.apache.poi.poifs.filesystem.NPOIFSFileSystem; | |||
/** | |||
* <p>This is a sample application showing how to easily modify properties in | |||
* the summary information and in the document summary information. The | |||
* application reads the name of a POI filesystem from the command line and | |||
* performs the following actions:</p> | |||
* | |||
* <ul> | |||
* | |||
* <li><p>Open the POI filesystem.</p></li> | |||
* | |||
* <li><p>Read the summary information.</p></li> | |||
* | |||
* <li><p>Read and print the "author" property.</p></li> | |||
* | |||
* <li><p>Change the author to "Rainer Klute".</p></li> | |||
* | |||
* <li><p>Read the document summary information.</p></li> | |||
* | |||
* <li><p>Read and print the "category" property.</p></li> | |||
* | |||
* <li><p>Change the category to "POI example".</p></li> | |||
* | |||
* <li><p>Read the custom properties (if available).</p></li> | |||
* | |||
* <li><p>Insert a new custom property.</p></li> | |||
* | |||
* <li><p>Write the custom properties back to the document summary | |||
* information.</p></li> | |||
* | |||
* <li><p>Write the summary information to the POI filesystem.</p></li> | |||
* | |||
* <li><p>Write the document summary information to the POI filesystem.</p></li> | |||
* | |||
* <li><p>Write the POI filesystem back to the original file.</p></li> | |||
* | |||
* </ol> | |||
*/ | |||
public class ModifyDocumentSummaryInformation { | |||
/** | |||
* <p>Main method - see class description.</p> | |||
* | |||
* @param args The command-line parameters. | |||
* @throws IOException | |||
* @throws MarkUnsupportedException | |||
* @throws NoPropertySetStreamException | |||
* @throws UnexpectedPropertySetTypeException | |||
* @throws WritingNotSupportedException | |||
*/ | |||
public static void main(final String[] args) throws IOException, | |||
NoPropertySetStreamException, MarkUnsupportedException, | |||
UnexpectedPropertySetTypeException, WritingNotSupportedException | |||
{ | |||
/* Read the name of the POI filesystem to modify from the command line. | |||
* For brevity to boundary check is performed on the command-line | |||
* arguments. */ | |||
File summaryFile = new File(args[0]); | |||
/* Open the POI filesystem. */ | |||
NPOIFSFileSystem poifs = new NPOIFSFileSystem(summaryFile, false); | |||
/* Read the summary information. */ | |||
DirectoryEntry dir = poifs.getRoot(); | |||
SummaryInformation si; | |||
try | |||
{ | |||
si = (SummaryInformation)PropertySetFactory.create( | |||
dir, SummaryInformation.DEFAULT_STREAM_NAME); | |||
} | |||
catch (FileNotFoundException ex) | |||
{ | |||
// There is no summary information yet. We have to create a new one | |||
si = PropertySetFactory.newSummaryInformation(); | |||
} | |||
/* Change the author to "Rainer Klute". Any former author value will | |||
* be lost. If there has been no author yet, it will be created. */ | |||
si.setAuthor("Rainer Klute"); | |||
System.out.println("Author changed to " + si.getAuthor() + "."); | |||
/* Handling the document summary information is analogous to handling | |||
* the summary information. An additional feature, however, are the | |||
* custom properties. */ | |||
/* Read the document summary information. */ | |||
DocumentSummaryInformation dsi; | |||
try | |||
{ | |||
dsi = (DocumentSummaryInformation)PropertySetFactory.create( | |||
dir, DocumentSummaryInformation.DEFAULT_STREAM_NAME); | |||
} | |||
catch (FileNotFoundException ex) | |||
{ | |||
/* There is no document summary information yet. We have to create a | |||
* new one. */ | |||
dsi = PropertySetFactory.newDocumentSummaryInformation(); | |||
} | |||
/* Change the category to "POI example". Any former category value will | |||
* be lost. If there has been no category yet, it will be created. */ | |||
dsi.setCategory("POI example"); | |||
System.out.println("Category changed to " + dsi.getCategory() + "."); | |||
/* Read the custom properties. If there are no custom properties yet, | |||
* the application has to create a new CustomProperties object. It will | |||
* serve as a container for custom properties. */ | |||
CustomProperties customProperties = dsi.getCustomProperties(); | |||
if (customProperties == null) | |||
customProperties = new CustomProperties(); | |||
/* Insert some custom properties into the container. */ | |||
customProperties.put("Key 1", "Value 1"); | |||
customProperties.put("Schl\u00fcssel 2", "Wert 2"); | |||
customProperties.put("Sample Number", new Integer(12345)); | |||
customProperties.put("Sample Boolean", Boolean.TRUE); | |||
customProperties.put("Sample Date", new Date()); | |||
/* Read a custom property. */ | |||
Object value = customProperties.get("Sample Number"); | |||
System.out.println("Custom Sample Number is now " + value); | |||
/* Write the custom properties back to the document summary | |||
* information. */ | |||
dsi.setCustomProperties(customProperties); | |||
/* Write the summary information and the document summary information | |||
* to the POI filesystem. */ | |||
si.write(dir, SummaryInformation.DEFAULT_STREAM_NAME); | |||
dsi.write(dir, DocumentSummaryInformation.DEFAULT_STREAM_NAME); | |||
/* Write the POI filesystem back to the original file. Please note that | |||
* in production code you should take care when write directly to the | |||
* origin, to make sure you don't loose things on error */ | |||
poifs.writeFilesystem(); | |||
poifs.close(); | |||
} | |||
} |
@@ -1,135 +0,0 @@ | |||
/* ==================================================================== | |||
Licensed to the Apache Software Foundation (ASF) under one or more | |||
contributor license agreements. See the NOTICE file distributed with | |||
this work for additional information regarding copyright ownership. | |||
The ASF licenses this file to You under the Apache License, Version 2.0 | |||
(the "License"); you may not use this file except in compliance with | |||
the License. You may obtain a copy of the License at | |||
http://www.apache.org/licenses/LICENSE-2.0 | |||
Unless required by applicable law or agreed to in writing, software | |||
distributed under the License is distributed on an "AS IS" BASIS, | |||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | |||
See the License for the specific language governing permissions and | |||
limitations under the License. | |||
==================================================================== */ | |||
package org.apache.poi.hpsf.examples; | |||
import java.io.FileInputStream; | |||
import java.io.IOException; | |||
import java.util.Iterator; | |||
import java.util.List; | |||
import org.apache.poi.hpsf.NoPropertySetStreamException; | |||
import org.apache.poi.hpsf.Property; | |||
import org.apache.poi.hpsf.PropertySet; | |||
import org.apache.poi.hpsf.PropertySetFactory; | |||
import org.apache.poi.hpsf.Section; | |||
import org.apache.poi.poifs.eventfilesystem.POIFSReader; | |||
import org.apache.poi.poifs.eventfilesystem.POIFSReaderEvent; | |||
import org.apache.poi.poifs.eventfilesystem.POIFSReaderListener; | |||
import org.apache.poi.util.HexDump; | |||
/** | |||
* <p>Sample application showing how to read a document's custom property set. | |||
* Call it with the document's file name as command-line parameter.</p> | |||
* | |||
* <p>Explanations can be found in the HPSF HOW-TO.</p> | |||
*/ | |||
public class ReadCustomPropertySets | |||
{ | |||
/** | |||
* <p>Runs the example program.</p> | |||
* | |||
* @param args Command-line arguments (unused). | |||
* @throws IOException if any I/O exception occurs. | |||
*/ | |||
public static void main(final String[] args) | |||
throws IOException | |||
{ | |||
final String filename = args[0]; | |||
POIFSReader r = new POIFSReader(); | |||
/* Register a listener for *all* documents. */ | |||
r.registerListener(new MyPOIFSReaderListener()); | |||
r.read(new FileInputStream(filename)); | |||
} | |||
static class MyPOIFSReaderListener implements POIFSReaderListener | |||
{ | |||
@Override | |||
public void processPOIFSReaderEvent(final POIFSReaderEvent event) | |||
{ | |||
PropertySet ps = null; | |||
try | |||
{ | |||
ps = PropertySetFactory.create(event.getStream()); | |||
} | |||
catch (NoPropertySetStreamException ex) | |||
{ | |||
out("No property set stream: \"" + event.getPath() + | |||
event.getName() + "\""); | |||
return; | |||
} | |||
catch (Exception ex) | |||
{ | |||
throw new RuntimeException | |||
("Property set stream \"" + | |||
event.getPath() + event.getName() + "\": " + ex); | |||
} | |||
/* Print the name of the property set stream: */ | |||
out("Property set stream \"" + event.getPath() + | |||
event.getName() + "\":"); | |||
/* Print the number of sections: */ | |||
final long sectionCount = ps.getSectionCount(); | |||
out(" No. of sections: " + sectionCount); | |||
/* Print the list of sections: */ | |||
List<Section> sections = ps.getSections(); | |||
int nr = 0; | |||
for (Iterator<Section> i = sections.iterator(); i.hasNext();) | |||
{ | |||
/* Print a single section: */ | |||
Section sec = i.next(); | |||
out(" Section " + nr++ + ":"); | |||
String s = hex(sec.getFormatID().getBytes()); | |||
s = s.substring(0, s.length() - 1); | |||
out(" Format ID: " + s); | |||
/* Print the number of properties in this section. */ | |||
int propertyCount = sec.getPropertyCount(); | |||
out(" No. of properties: " + propertyCount); | |||
/* Print the properties: */ | |||
Property[] properties = sec.getProperties(); | |||
for (int i2 = 0; i2 < properties.length; i2++) | |||
{ | |||
/* Print a single property: */ | |||
Property p = properties[i2]; | |||
long id = p.getID(); | |||
long type = p.getType(); | |||
Object value = p.getValue(); | |||
out(" Property ID: " + id + ", type: " + type + | |||
", value: " + value); | |||
} | |||
} | |||
} | |||
} | |||
static void out(final String msg) | |||
{ | |||
System.out.println(msg); | |||
} | |||
static String hex(final byte[] bytes) | |||
{ | |||
return HexDump.dump(bytes, 0L, 0); | |||
} | |||
} |
@@ -1,80 +0,0 @@ | |||
/* ==================================================================== | |||
Licensed to the Apache Software Foundation (ASF) under one or more | |||
contributor license agreements. See the NOTICE file distributed with | |||
this work for additional information regarding copyright ownership. | |||
The ASF licenses this file to You under the Apache License, Version 2.0 | |||
(the "License"); you may not use this file except in compliance with | |||
the License. You may obtain a copy of the License at | |||
http://www.apache.org/licenses/LICENSE-2.0 | |||
Unless required by applicable law or agreed to in writing, software | |||
distributed under the License is distributed on an "AS IS" BASIS, | |||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | |||
See the License for the specific language governing permissions and | |||
limitations under the License. | |||
==================================================================== */ | |||
package org.apache.poi.hpsf.examples; | |||
import java.io.FileInputStream; | |||
import java.io.IOException; | |||
import org.apache.poi.hpsf.PropertySetFactory; | |||
import org.apache.poi.hpsf.SummaryInformation; | |||
import org.apache.poi.poifs.eventfilesystem.POIFSReader; | |||
import org.apache.poi.poifs.eventfilesystem.POIFSReaderEvent; | |||
import org.apache.poi.poifs.eventfilesystem.POIFSReaderListener; | |||
/** | |||
* <p>Sample application showing how to read a OLE 2 document's | |||
* title. Call it with the document's file name as command line | |||
* parameter.</p> | |||
* | |||
* <p>Explanations can be found in the HPSF HOW-TO.</p> | |||
*/ | |||
public class ReadTitle | |||
{ | |||
/** | |||
* <p>Runs the example program.</p> | |||
* | |||
* @param args Command-line arguments. The first command-line argument must | |||
* be the name of a POI filesystem to read. | |||
* @throws IOException if any I/O exception occurs. | |||
*/ | |||
public static void main(final String[] args) throws IOException | |||
{ | |||
final String filename = args[0]; | |||
POIFSReader r = new POIFSReader(); | |||
r.registerListener(new MyPOIFSReaderListener(), | |||
"\005SummaryInformation"); | |||
r.read(new FileInputStream(filename)); | |||
} | |||
static class MyPOIFSReaderListener implements POIFSReaderListener | |||
{ | |||
@Override | |||
public void processPOIFSReaderEvent(final POIFSReaderEvent event) | |||
{ | |||
SummaryInformation si = null; | |||
try | |||
{ | |||
si = (SummaryInformation) | |||
PropertySetFactory.create(event.getStream()); | |||
} | |||
catch (Exception ex) | |||
{ | |||
throw new RuntimeException | |||
("Property set stream \"" + | |||
event.getPath() + event.getName() + "\": " + ex); | |||
} | |||
final String title = si.getTitle(); | |||
if (title != null) | |||
System.out.println("Title: \"" + title + "\""); | |||
else | |||
System.out.println("Document has no title."); | |||
} | |||
} | |||
} |
@@ -1,420 +0,0 @@ | |||
/* ==================================================================== | |||
Licensed to the Apache Software Foundation (ASF) under one or more | |||
contributor license agreements. See the NOTICE file distributed with | |||
this work for additional information regarding copyright ownership. | |||
The ASF licenses this file to You under the Apache License, Version 2.0 | |||
(the "License"); you may not use this file except in compliance with | |||
the License. You may obtain a copy of the License at | |||
http://www.apache.org/licenses/LICENSE-2.0 | |||
Unless required by applicable law or agreed to in writing, software | |||
distributed under the License is distributed on an "AS IS" BASIS, | |||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | |||
See the License for the specific language governing permissions and | |||
limitations under the License. | |||
==================================================================== */ | |||
package org.apache.poi.hpsf.examples; | |||
import java.io.ByteArrayInputStream; | |||
import java.io.ByteArrayOutputStream; | |||
import java.io.FileInputStream; | |||
import java.io.FileNotFoundException; | |||
import java.io.FileOutputStream; | |||
import java.io.IOException; | |||
import java.io.InputStream; | |||
import java.io.OutputStream; | |||
import java.util.HashMap; | |||
import java.util.Map; | |||
import org.apache.poi.hpsf.HPSFRuntimeException; | |||
import org.apache.poi.hpsf.MarkUnsupportedException; | |||
import org.apache.poi.hpsf.MutablePropertySet; | |||
import org.apache.poi.hpsf.MutableSection; | |||
import org.apache.poi.hpsf.NoPropertySetStreamException; | |||
import org.apache.poi.hpsf.PropertySet; | |||
import org.apache.poi.hpsf.PropertySetFactory; | |||
import org.apache.poi.hpsf.SummaryInformation; | |||
import org.apache.poi.hpsf.Util; | |||
import org.apache.poi.hpsf.Variant; | |||
import org.apache.poi.hpsf.WritingNotSupportedException; | |||
import org.apache.poi.hpsf.wellknown.PropertyIDMap; | |||
import org.apache.poi.poifs.eventfilesystem.POIFSReader; | |||
import org.apache.poi.poifs.eventfilesystem.POIFSReaderEvent; | |||
import org.apache.poi.poifs.eventfilesystem.POIFSReaderListener; | |||
import org.apache.poi.poifs.filesystem.DirectoryEntry; | |||
import org.apache.poi.poifs.filesystem.DocumentInputStream; | |||
import org.apache.poi.poifs.filesystem.POIFSDocumentPath; | |||
import org.apache.poi.poifs.filesystem.POIFSFileSystem; | |||
/** | |||
* <p>This class is a sample application which shows how to write or modify the | |||
* author and title property of an OLE 2 document. This could be done in two | |||
* different ways:</p> | |||
* | |||
* <ul> | |||
* | |||
* <li><p>The first approach is to open the OLE 2 file as a POI filesystem | |||
* (see class {@link POIFSFileSystem}), read the summary information property | |||
* set (see classes {@link SummaryInformation} and {@link PropertySet}), write | |||
* the author and title properties into it and write the property set back into | |||
* the POI filesystem.</p></li> | |||
* | |||
* <li><p>The second approach does not modify the original POI filesystem, but | |||
* instead creates a new one. All documents from the original POIFS are copied | |||
* to the destination POIFS, except for the summary information stream. The | |||
* latter is modified by setting the author and title property before writing | |||
* it to the destination POIFS. It there are several summary information streams | |||
* in the original POIFS - e.g. in subordinate directories - they are modified | |||
* just the same.</p></li> | |||
* | |||
* </ul> | |||
* | |||
* <p>This sample application takes the second approach. It expects the name of | |||
* the existing POI filesystem's name as its first command-line parameter and | |||
* the name of the output POIFS as the second command-line argument. The | |||
* program then works as described above: It copies nearly all documents | |||
* unmodified from the input POI filesystem to the output POI filesystem. If it | |||
* encounters a summary information stream it reads its properties. Then it sets | |||
* the "author" and "title" properties to new values and writes the modified | |||
* summary information stream into the output file.</p> | |||
* | |||
* <p>Further explanations can be found in the HPSF HOW-TO.</p> | |||
*/ | |||
public class WriteAuthorAndTitle | |||
{ | |||
/** | |||
* <p>Runs the example program.</p> | |||
* | |||
* @param args Command-line arguments. The first command-line argument must | |||
* be the name of a POI filesystem to read. | |||
* @throws IOException if any I/O exception occurs. | |||
*/ | |||
public static void main(final String[] args) throws IOException | |||
{ | |||
/* Check whether we have exactly two command-line arguments. */ | |||
if (args.length != 2) | |||
{ | |||
System.err.println("Usage: " + WriteAuthorAndTitle.class.getName() + | |||
" originPOIFS destinationPOIFS"); | |||
System.exit(1); | |||
} | |||
/* Read the names of the origin and destination POI filesystems. */ | |||
final String srcName = args[0]; | |||
final String dstName = args[1]; | |||
/* Read the origin POIFS using the eventing API. The real work is done | |||
* in the class ModifySICopyTheRest which is registered here as a | |||
* POIFSReader. */ | |||
final POIFSReader r = new POIFSReader(); | |||
final ModifySICopyTheRest msrl = new ModifySICopyTheRest(dstName); | |||
r.registerListener(msrl); | |||
FileInputStream fis = new FileInputStream(srcName); | |||
r.read(fis); | |||
fis.close(); | |||
/* Write the new POIFS to disk. */ | |||
msrl.close(); | |||
} | |||
/** | |||
* <p>This class does all the work. As its name implies it modifies a | |||
* summary information property set and copies everything else unmodified | |||
* to the destination POI filesystem. Since an instance of it is registered | |||
* as a {@link POIFSReader} its method {@link | |||
* #processPOIFSReaderEvent(POIFSReaderEvent)} is called for each document | |||
* in the origin POIFS.</p> | |||
*/ | |||
static class ModifySICopyTheRest implements POIFSReaderListener | |||
{ | |||
String dstName; | |||
OutputStream out; | |||
POIFSFileSystem poiFs; | |||
/** | |||
* <p>The constructor of a {@link ModifySICopyTheRest} instance creates | |||
* the target POIFS. It also stores the name of the file the POIFS will | |||
* be written to once it is complete.</p> | |||
* | |||
* @param dstName The name of the disk file the destination POIFS is to | |||
* be written to. | |||
*/ | |||
public ModifySICopyTheRest(final String dstName) | |||
{ | |||
this.dstName = dstName; | |||
poiFs = new POIFSFileSystem(); | |||
} | |||
/** | |||
* <p>The method is called by POI's eventing API for each file in the | |||
* origin POIFS.</p> | |||
*/ | |||
@Override | |||
public void processPOIFSReaderEvent(final POIFSReaderEvent event) | |||
{ | |||
/* The following declarations are shortcuts for accessing the | |||
* "event" object. */ | |||
final POIFSDocumentPath path = event.getPath(); | |||
final String name = event.getName(); | |||
final DocumentInputStream stream = event.getStream(); | |||
Throwable t = null; | |||
try | |||
{ | |||
/* Find out whether the current document is a property set | |||
* stream or not. */ | |||
if (PropertySet.isPropertySetStream(stream)) | |||
{ | |||
/* Yes, the current document is a property set stream. | |||
* Let's create a PropertySet instance from it. */ | |||
PropertySet ps = null; | |||
try | |||
{ | |||
ps = PropertySetFactory.create(stream); | |||
} | |||
catch (NoPropertySetStreamException ex) | |||
{ | |||
/* This exception will not be thrown because we already | |||
* checked above. */ | |||
} | |||
/* Now we know that we really have a property set. The next | |||
* step is to find out whether it is a summary information | |||
* or not. */ | |||
if (ps.isSummaryInformation()) | |||
/* Yes, it is a summary information. We will modify it | |||
* and write the result to the destination POIFS. */ | |||
editSI(poiFs, path, name, ps); | |||
else | |||
/* No, it is not a summary information. We don't care | |||
* about its internals and copy it unmodified to the | |||
* destination POIFS. */ | |||
copy(poiFs, path, name, ps); | |||
} | |||
else | |||
/* No, the current document is not a property set stream. We | |||
* copy it unmodified to the destination POIFS. */ | |||
copy(poiFs, event.getPath(), event.getName(), stream); | |||
} | |||
catch (MarkUnsupportedException ex) | |||
{ | |||
t = ex; | |||
} | |||
catch (IOException ex) | |||
{ | |||
t = ex; | |||
} | |||
catch (WritingNotSupportedException ex) | |||
{ | |||
t = ex; | |||
} | |||
/* According to the definition of the processPOIFSReaderEvent method | |||
* we cannot pass checked exceptions to the caller. The following | |||
* lines check whether a checked exception occured and throws an | |||
* unchecked exception. The message of that exception is that of | |||
* the underlying checked exception. */ | |||
if (t != null) | |||
{ | |||
throw new HPSFRuntimeException | |||
("Could not read file \"" + path + "/" + name + | |||
"\". Reason: " + Util.toString(t)); | |||
} | |||
} | |||
/** | |||
* <p>Receives a summary information property set modifies (or creates) | |||
* its "author" and "title" properties and writes the result under the | |||
* same path and name as the origin to a destination POI filesystem.</p> | |||
* | |||
* @param poiFs The POI filesystem to write to. | |||
* @param path The original (and destination) stream's path. | |||
* @param name The original (and destination) stream's name. | |||
* @param si The property set. It should be a summary information | |||
* property set. | |||
* @throws IOException | |||
* @throws WritingNotSupportedException | |||
*/ | |||
public void editSI(final POIFSFileSystem poiFs, | |||
final POIFSDocumentPath path, | |||
final String name, | |||
final PropertySet si) | |||
throws WritingNotSupportedException, IOException | |||
{ | |||
/* Get the directory entry for the target stream. */ | |||
final DirectoryEntry de = getPath(poiFs, path); | |||
/* Create a mutable property set as a copy of the original read-only | |||
* property set. */ | |||
final MutablePropertySet mps = new MutablePropertySet(si); | |||
/* Retrieve the section containing the properties to modify. A | |||
* summary information property set contains exactly one section. */ | |||
final MutableSection s = | |||
(MutableSection) mps.getSections().get(0); | |||
/* Set the properties. */ | |||
s.setProperty(PropertyIDMap.PID_AUTHOR, Variant.VT_LPSTR, | |||
"Rainer Klute"); | |||
s.setProperty(PropertyIDMap.PID_TITLE, Variant.VT_LPWSTR, | |||
"Test"); | |||
/* Create an input stream containing the bytes the property set | |||
* stream consists of. */ | |||
final InputStream pss = mps.toInputStream(); | |||
/* Write the property set stream to the POIFS. */ | |||
de.createDocument(name, pss); | |||
} | |||
/** | |||
* <p>Writes a {@link PropertySet} to a POI filesystem. This method is | |||
* simpler than {@link #editSI} because the origin property set has just | |||
* to be copied.</p> | |||
* | |||
* @param poiFs The POI filesystem to write to. | |||
* @param path The file's path in the POI filesystem. | |||
* @param name The file's name in the POI filesystem. | |||
* @param ps The property set to write. | |||
* @throws WritingNotSupportedException | |||
* @throws IOException | |||
*/ | |||
public void copy(final POIFSFileSystem poiFs, | |||
final POIFSDocumentPath path, | |||
final String name, | |||
final PropertySet ps) | |||
throws WritingNotSupportedException, IOException | |||
{ | |||
final DirectoryEntry de = getPath(poiFs, path); | |||
final MutablePropertySet mps = new MutablePropertySet(ps); | |||
de.createDocument(name, mps.toInputStream()); | |||
} | |||
/** | |||
* <p>Copies the bytes from a {@link DocumentInputStream} to a new | |||
* stream in a POI filesystem.</p> | |||
* | |||
* @param poiFs The POI filesystem to write to. | |||
* @param path The source document's path. | |||
* @param name The source document's name. | |||
* @param stream The stream containing the source document. | |||
* @throws IOException | |||
*/ | |||
public void copy(final POIFSFileSystem poiFs, | |||
final POIFSDocumentPath path, | |||
final String name, | |||
final DocumentInputStream stream) throws IOException | |||
{ | |||
final DirectoryEntry de = getPath(poiFs, path); | |||
final ByteArrayOutputStream out = new ByteArrayOutputStream(); | |||
int c; | |||
while ((c = stream.read()) != -1) | |||
out.write(c); | |||
stream.close(); | |||
out.close(); | |||
final InputStream in = | |||
new ByteArrayInputStream(out.toByteArray()); | |||
de.createDocument(name, in); | |||
} | |||
/** | |||
* <p>Writes the POI file system to a disk file.</p> | |||
* | |||
* @throws FileNotFoundException | |||
* @throws IOException | |||
*/ | |||
public void close() throws FileNotFoundException, IOException | |||
{ | |||
out = new FileOutputStream(dstName); | |||
poiFs.writeFilesystem(out); | |||
out.close(); | |||
} | |||
/** Contains the directory paths that have already been created in the | |||
* output POI filesystem and maps them to their corresponding | |||
* {@link org.apache.poi.poifs.filesystem.DirectoryNode}s. */ | |||
private final Map<String, DirectoryEntry> paths = new HashMap<String, DirectoryEntry>(); | |||
/** | |||
* <p>Ensures that the directory hierarchy for a document in a POI | |||
* fileystem is in place. When a document is to be created somewhere in | |||
* a POI filesystem its directory must be created first. This method | |||
* creates all directories between the POI filesystem root and the | |||
* directory the document should belong to which do not yet exist.</p> | |||
* | |||
* <p>Unfortunately POI does not offer a simple method to interrogate | |||
* the POIFS whether a certain child node (file or directory) exists in | |||
* a directory. However, since we always start with an empty POIFS which | |||
* contains the root directory only and since each directory in the | |||
* POIFS is created by this method we can maintain the POIFS's directory | |||
* hierarchy ourselves: The {@link DirectoryEntry} of each directory | |||
* created is stored in a {@link Map}. The directories' path names map | |||
* to the corresponding {@link DirectoryEntry} instances.</p> | |||
* | |||
* @param poiFs The POI filesystem the directory hierarchy is created | |||
* in, if needed. | |||
* @param path The document's path. This method creates those directory | |||
* components of this hierarchy which do not yet exist. | |||
* @return The directory entry of the document path's parent. The caller | |||
* should use this {@link DirectoryEntry} to create documents in it. | |||
*/ | |||
public DirectoryEntry getPath(final POIFSFileSystem poiFs, | |||
final POIFSDocumentPath path) | |||
{ | |||
try | |||
{ | |||
/* Check whether this directory has already been created. */ | |||
final String s = path.toString(); | |||
DirectoryEntry de = paths.get(s); | |||
if (de != null) | |||
/* Yes: return the corresponding DirectoryEntry. */ | |||
return de; | |||
/* No: We have to create the directory - or return the root's | |||
* DirectoryEntry. */ | |||
int l = path.length(); | |||
if (l == 0) | |||
/* Get the root directory. It does not have to be created | |||
* since it always exists in a POIFS. */ | |||
de = poiFs.getRoot(); | |||
else | |||
{ | |||
/* Create a subordinate directory. The first step is to | |||
* ensure that the parent directory exists: */ | |||
de = getPath(poiFs, path.getParent()); | |||
/* Now create the target directory: */ | |||
de = de.createDirectory(path.getComponent | |||
(path.length() - 1)); | |||
} | |||
paths.put(s, de); | |||
return de; | |||
} | |||
catch (IOException ex) | |||
{ | |||
/* This exception will be thrown if the directory already | |||
* exists. However, since we have full control about directory | |||
* creation we can ensure that this will never happen. */ | |||
ex.printStackTrace(System.err); | |||
throw new RuntimeException(ex); | |||
} | |||
} | |||
} | |||
} |
@@ -1,103 +0,0 @@ | |||
/* ==================================================================== | |||
Licensed to the Apache Software Foundation (ASF) under one or more | |||
contributor license agreements. See the NOTICE file distributed with | |||
this work for additional information regarding copyright ownership. | |||
The ASF licenses this file to You under the Apache License, Version 2.0 | |||
(the "License"); you may not use this file except in compliance with | |||
the License. You may obtain a copy of the License at | |||
http://www.apache.org/licenses/LICENSE-2.0 | |||
Unless required by applicable law or agreed to in writing, software | |||
distributed under the License is distributed on an "AS IS" BASIS, | |||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | |||
See the License for the specific language governing permissions and | |||
limitations under the License. | |||
==================================================================== */ | |||
package org.apache.poi.hpsf.examples; | |||
import java.io.FileOutputStream; | |||
import java.io.IOException; | |||
import java.io.InputStream; | |||
import org.apache.poi.hpsf.MutableProperty; | |||
import org.apache.poi.hpsf.MutablePropertySet; | |||
import org.apache.poi.hpsf.MutableSection; | |||
import org.apache.poi.hpsf.SummaryInformation; | |||
import org.apache.poi.hpsf.Variant; | |||
import org.apache.poi.hpsf.WritingNotSupportedException; | |||
import org.apache.poi.hpsf.wellknown.PropertyIDMap; | |||
import org.apache.poi.hpsf.wellknown.SectionIDMap; | |||
import org.apache.poi.poifs.filesystem.POIFSFileSystem; | |||
/** | |||
* <p>This class is a simple sample application showing how to create a property | |||
* set and write it to disk.</p> | |||
*/ | |||
public class WriteTitle | |||
{ | |||
/** | |||
* <p>Runs the example program.</p> | |||
* | |||
* @param args Command-line arguments. The first and only command-line | |||
* argument is the name of the POI file system to create. | |||
* @throws IOException if any I/O exception occurs. | |||
* @throws WritingNotSupportedException if HPSF does not (yet) support | |||
* writing a certain property type. | |||
*/ | |||
public static void main(final String[] args) | |||
throws WritingNotSupportedException, IOException | |||
{ | |||
/* Check whether we have exactly one command-line argument. */ | |||
if (args.length != 1) | |||
{ | |||
System.err.println("Usage: " + WriteTitle.class.getName() + | |||
"destinationPOIFS"); | |||
System.exit(1); | |||
} | |||
final String fileName = args[0]; | |||
/* Create a mutable property set. Initially it contains a single section | |||
* with no properties. */ | |||
final MutablePropertySet mps = new MutablePropertySet(); | |||
/* Retrieve the section the property set already contains. */ | |||
final MutableSection ms = (MutableSection) mps.getSections().get(0); | |||
/* Turn the property set into a summary information property. This is | |||
* done by setting the format ID of its first section to | |||
* SectionIDMap.SUMMARY_INFORMATION_ID. */ | |||
ms.setFormatID(SectionIDMap.SUMMARY_INFORMATION_ID); | |||
/* Create an empty property. */ | |||
final MutableProperty p = new MutableProperty(); | |||
/* Fill the property with appropriate settings so that it specifies the | |||
* document's title. */ | |||
p.setID(PropertyIDMap.PID_TITLE); | |||
p.setType(Variant.VT_LPWSTR); | |||
p.setValue("Sample title"); | |||
/* Place the property into the section. */ | |||
ms.setProperty(p); | |||
/* Create the POI file system the property set is to be written to. */ | |||
final POIFSFileSystem poiFs = new POIFSFileSystem(); | |||
/* For writing the property set into a POI file system it has to be | |||
* handed over to the POIFS.createDocument() method as an input stream | |||
* which produces the bytes making out the property set stream. */ | |||
final InputStream is = mps.toInputStream(); | |||
/* Create the summary information property set in the POI file | |||
* system. It is given the default name most (if not all) summary | |||
* information property sets have. */ | |||
poiFs.createDocument(is, SummaryInformation.DEFAULT_STREAM_NAME); | |||
/* Write the whole POI file system to a disk file. */ | |||
poiFs.writeFilesystem(new FileOutputStream(fileName)); | |||
} | |||
} |
@@ -1,456 +0,0 @@ | |||
/* ==================================================================== | |||
Licensed to the Apache Software Foundation (ASF) under one or more | |||
contributor license agreements. See the NOTICE file distributed with | |||
this work for additional information regarding copyright ownership. | |||
The ASF licenses this file to You under the Apache License, Version 2.0 | |||
(the "License"); you may not use this file except in compliance with | |||
the License. You may obtain a copy of the License at | |||
http://www.apache.org/licenses/LICENSE-2.0 | |||
Unless required by applicable law or agreed to in writing, software | |||
distributed under the License is distributed on an "AS IS" BASIS, | |||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | |||
See the License for the specific language governing permissions and | |||
limitations under the License. | |||
==================================================================== */ | |||
package org.apache.poi.hslf.examples; | |||
import java.awt.Color; | |||
import java.awt.Dimension; | |||
import java.awt.Font; | |||
import java.awt.Graphics2D; | |||
import java.awt.Rectangle; | |||
import java.awt.geom.Rectangle2D; | |||
import java.io.FileOutputStream; | |||
import java.io.IOException; | |||
import java.util.List; | |||
import org.apache.poi.hslf.usermodel.HSLFSlideShow; | |||
import org.apache.poi.sl.draw.DrawTableShape; | |||
import org.apache.poi.sl.draw.SLGraphics; | |||
import org.apache.poi.sl.usermodel.AutoShape; | |||
import org.apache.poi.sl.usermodel.GroupShape; | |||
import org.apache.poi.sl.usermodel.ShapeType; | |||
import org.apache.poi.sl.usermodel.Slide; | |||
import org.apache.poi.sl.usermodel.SlideShow; | |||
import org.apache.poi.sl.usermodel.TableCell; | |||
import org.apache.poi.sl.usermodel.TableShape; | |||
import org.apache.poi.sl.usermodel.TextBox; | |||
import org.apache.poi.sl.usermodel.TextParagraph; | |||
import org.apache.poi.sl.usermodel.TextRun; | |||
import org.apache.poi.sl.usermodel.TextShape.TextPlaceholder; | |||
import org.apache.poi.sl.usermodel.VerticalAlignment; | |||
/** | |||
* Presentation for Fast Feather Track on ApacheconEU 2008 | |||
* | |||
* @author Yegor Kozlov | |||
*/ | |||
public final class ApacheconEU08 { | |||
public static void main(String[] args) throws IOException { | |||
SlideShow<?,?> ppt = new HSLFSlideShow(); | |||
// SlideShow<?,?> ppt = new XMLSlideShow(); | |||
ppt.setPageSize(new Dimension(720, 540)); | |||
slide1(ppt); | |||
slide2(ppt); | |||
slide3(ppt); | |||
slide4(ppt); | |||
slide5(ppt); | |||
slide6(ppt); | |||
slide7(ppt); | |||
slide8(ppt); | |||
slide9(ppt); | |||
slide10(ppt); | |||
slide11(ppt); | |||
slide12(ppt); | |||
String ext = ppt.getClass().getName().contains("HSLF") ? "ppt" : "pptx"; | |||
FileOutputStream out = new FileOutputStream("apachecon_eu_08."+ext); | |||
ppt.write(out); | |||
out.close(); | |||
ppt.close(); | |||
} | |||
public static void slide1(SlideShow<?,?> ppt) throws IOException { | |||
Slide<?,?> slide = ppt.createSlide(); | |||
TextBox<?,?> box1 = slide.createTextBox(); | |||
box1.setTextPlaceholder(TextPlaceholder.CENTER_TITLE); | |||
box1.setText("POI-HSLF"); | |||
box1.setAnchor(new Rectangle(54, 78, 612, 115)); | |||
TextBox<?,?> box2 = slide.createTextBox(); | |||
box2.setTextPlaceholder(TextPlaceholder.CENTER_BODY); | |||
box2.setText("Java API To Access Microsoft PowerPoint Format Files"); | |||
box2.setAnchor(new Rectangle(108, 204, 504, 138)); | |||
TextBox<?,?> box3 = slide.createTextBox(); | |||
box3.getTextParagraphs().get(0).getTextRuns().get(0).setFontSize(32d); | |||
box3.setText( | |||
"Yegor Kozlov\r" + | |||
"yegor - apache - org"); | |||
box3.setHorizontalCentered(true); | |||
box3.setAnchor(new Rectangle(206, 348, 310, 84)); | |||
} | |||
public static void slide2(SlideShow<?,?> ppt) throws IOException { | |||
Slide<?,?> slide = ppt.createSlide(); | |||
TextBox<?,?> box1 = slide.createTextBox(); | |||
box1.setTextPlaceholder(TextPlaceholder.TITLE); | |||
box1.setText("What is HSLF?"); | |||
box1.setAnchor(new Rectangle(36, 21, 648, 90)); | |||
TextBox<?,?> box2 = slide.createTextBox(); | |||
box2.setTextPlaceholder(TextPlaceholder.BODY); | |||
box2.setText("HorribleSLideshowFormat is the POI Project's pure Java implementation " + | |||
"of the Powerpoint binary file format. \r" + | |||
"POI sub-project since 2005\r" + | |||
"Started by Nick Burch, Yegor Kozlov joined soon after"); | |||
box2.setAnchor(new Rectangle(36, 126, 648, 356)); | |||
} | |||
public static void slide3(SlideShow<?,?> ppt) throws IOException { | |||
Slide<?,?> slide = ppt.createSlide(); | |||
TextBox<?,?> box1 = slide.createTextBox(); | |||
box1.setTextPlaceholder(TextPlaceholder.TITLE); | |||
box1.setText("HSLF in a Nutshell"); | |||
box1.setAnchor(new Rectangle(36, 15, 648, 65)); | |||
TextBox<?,?> box2 = slide.createTextBox(); | |||
box2.setTextPlaceholder(TextPlaceholder.BODY); | |||
box2.setText( | |||
"HSLF provides a way to read, create and modify MS PowerPoint presentations\r" + | |||
"Pure Java API - you don't need PowerPoint to read and write *.ppt files\r" + | |||
"Comprehensive support of PowerPoint objects\r" + | |||
"Rich text\r" + | |||
"Tables\r" + | |||
"Shapes\r" + | |||
"Pictures\r" + | |||
"Master slides\r" + | |||
"Access to low level data structures" | |||
); | |||
List<? extends TextParagraph<?,?,?>> tp = box2.getTextParagraphs(); | |||
for (int i : new byte[]{0,1,2,8}) { | |||
tp.get(i).getTextRuns().get(0).setFontSize(28d); | |||
} | |||
for (int i : new byte[]{3,4,5,6,7}) { | |||
tp.get(i).getTextRuns().get(0).setFontSize(24d); | |||
tp.get(i).setIndentLevel(1); | |||
} | |||
box2.setAnchor(new Rectangle(36, 80, 648, 400)); | |||
} | |||
public static void slide4(SlideShow<?,?> ppt) throws IOException { | |||
Slide<?,?> slide = ppt.createSlide(); | |||
String[][] txt1 = { | |||
{"Note"}, | |||
{"This presentation was created programmatically using POI HSLF"} | |||
}; | |||
TableShape<?,?> table1 = slide.createTable(2, 1); | |||
for (int i = 0; i < txt1.length; i++) { | |||
for (int j = 0; j < txt1[i].length; j++) { | |||
TableCell<?,?> cell = table1.getCell(i, j); | |||
cell.setText(txt1[i][j]); | |||
TextRun rt = cell.getTextParagraphs().get(0).getTextRuns().get(0); | |||
rt.setFontSize(10d); | |||
rt.setFontFamily("Arial"); | |||
rt.setBold(true); | |||
if(i == 0){ | |||
rt.setFontSize(32d); | |||
rt.setFontColor(Color.white); | |||
cell.setFillColor(new Color(0, 153, 204)); | |||
} else { | |||
rt.setFontSize(28d); | |||
cell.setFillColor(new Color(235, 239, 241)); | |||
} | |||
cell.setVerticalAlignment(VerticalAlignment.MIDDLE); | |||
} | |||
} | |||
DrawTableShape dts = new DrawTableShape(table1); | |||
dts.setAllBorders(1.0, Color.black); | |||
dts.setOutsideBorders(4.0); | |||
table1.setColumnWidth(0, 450); | |||
table1.setRowHeight(0, 50); | |||
table1.setRowHeight(1, 80); | |||
Dimension dim = ppt.getPageSize(); | |||
Rectangle2D oldAnchor = table1.getAnchor(); | |||
table1.setAnchor(new Rectangle2D.Double((dim.width-450)/2d, 100, oldAnchor.getWidth(), oldAnchor.getHeight())); | |||
TextBox<?,?> box1 = slide.createTextBox(); | |||
box1.setHorizontalCentered(true); | |||
box1.getTextParagraphs().get(0).getTextRuns().get(0).setFontSize(24d); | |||
box1.setText("The source code is available at\r" + | |||
"http://people.apache.org/~yegor/apachecon_eu08/"); | |||
box1.setAnchor(new Rectangle(80, 356, 553, 65)); | |||
} | |||
public static void slide5(SlideShow<?,?> ppt) throws IOException { | |||
Slide<?,?> slide = ppt.createSlide(); | |||
TextBox<?,?> box1 = slide.createTextBox(); | |||
box1.setTextPlaceholder(TextPlaceholder.TITLE); | |||
box1.setText("HSLF in Action - 1\rData Extraction"); | |||
box1.setAnchor(new Rectangle(36, 21, 648, 100)); | |||
TextBox<?,?> box2 = slide.createTextBox(); | |||
box2.setTextPlaceholder(TextPlaceholder.BODY); | |||
box2.setText( | |||
"Text from slides and notes\r" + | |||
"Images\r" + | |||
"Shapes and their properties (type, position in the slide, color, font, etc.)"); | |||
box2.setAnchor(new Rectangle(36, 150, 648, 300)); | |||
} | |||
public static void slide6(SlideShow<?,?> ppt) throws IOException { | |||
Slide<?,?> slide = ppt.createSlide(); | |||
TextBox<?,?> box1 = slide.createTextBox(); | |||
box1.setTextPlaceholder(TextPlaceholder.TITLE); | |||
box1.setText("HSLF in Action - 2"); | |||
box1.setAnchor(new Rectangle(36, 20, 648, 90)); | |||
TextBox<?,?> box2 = slide.createTextBox(); | |||
box2.getTextParagraphs().get(0).getTextRuns().get(0).setFontSize(18d); | |||
box2.setText("Creating a simple presentation from scratch"); | |||
box2.setAnchor(new Rectangle(170, 100, 364, 30)); | |||
TextBox<?,?> box3 = slide.createTextBox(); | |||
TextRun rt3 = box3.getTextParagraphs().get(0).getTextRuns().get(0); | |||
rt3.setFontFamily("Courier New"); | |||
rt3.setFontSize(8d); | |||
box3.setText( | |||
"SlideShow ppt = new SlideShow();\u000b" + | |||
"Slide slide = ppt.createSlide();\u000b" + | |||
"\u000b" + | |||
"TextBox box2 = new TextBox();\u000b" + | |||
"box2.setHorizontalAlignment(TextBox.AlignCenter);\u000b" + | |||
"box2.setVerticalAlignment(TextBox.AnchorMiddle);\u000b" + | |||
"box2.getTextRun().setText(\"Java Code\");\u000b" + | |||
"box2.getFill().setForegroundColor(new Color(187, 224, 227));\u000b" + | |||
"box2.setLineColor(Color.black);\u000b" + | |||
"box2.setLineWidth(0.75);\u000b" + | |||
"box2.setAnchor(new Rectangle(66, 243, 170, 170));\u000b" + | |||
"slide.addShape(box2);\u000b" + | |||
"\u000b" + | |||
"TextBox box3 = new TextBox();\u000b" + | |||
"box3.setHorizontalAlignment(TextBox.AlignCenter);\u000b" + | |||
"box3.setVerticalAlignment(TextBox.AnchorMiddle);\u000b" + | |||
"box3.getTextRun().setText(\"*.ppt file\");\u000b" + | |||
"box3.setLineWidth(0.75);\u000b" + | |||
"box3.setLineColor(Color.black);\u000b" + | |||
"box3.getFill().setForegroundColor(new Color(187, 224, 227));\u000b" + | |||
"box3.setAnchor(new Rectangle(473, 243, 170, 170));\u000b" + | |||
"slide.addShape(box3);\u000b" + | |||
"\u000b" + | |||
"AutoShape box4 = new AutoShape(ShapeTypes.Arrow);\u000b" + | |||
"box4.getFill().setForegroundColor(new Color(187, 224, 227));\u000b" + | |||
"box4.setLineWidth(0.75);\u000b" + | |||
"box4.setLineColor(Color.black);\u000b" + | |||
"box4.setAnchor(new Rectangle(253, 288, 198, 85));\u000b" + | |||
"slide.addShape(box4);\u000b" + | |||
"\u000b" + | |||
"FileOutputStream out = new FileOutputStream(\"hslf-demo.ppt\");\u000b" + | |||
"ppt.write(out);\u000b" + | |||
"out.close();"); | |||
box3.setAnchor(new Rectangle(30, 150, 618, 411)); | |||
box3.setHorizontalCentered(true); | |||
} | |||
public static void slide7(SlideShow<?,?> ppt) throws IOException { | |||
Slide<?,?> slide = ppt.createSlide(); | |||
TextBox<?,?> box2 = slide.createTextBox(); | |||
box2.setHorizontalCentered(true); | |||
box2.setVerticalAlignment(VerticalAlignment.MIDDLE); | |||
box2.setText("Java Code"); | |||
box2.setFillColor(new Color(187, 224, 227)); | |||
box2.setStrokeStyle(0.75, Color.black); | |||
box2.setAnchor(new Rectangle(66, 243, 170, 170)); | |||
TextBox<?,?> box3 = slide.createTextBox(); | |||
box3.setHorizontalCentered(true); | |||
box3.setVerticalAlignment(VerticalAlignment.MIDDLE); | |||
box3.setText("*.ppt file"); | |||
box3.setFillColor(new Color(187, 224, 227)); | |||
box3.setStrokeStyle(0.75, Color.black); | |||
box3.setAnchor(new Rectangle(473, 243, 170, 170)); | |||
AutoShape<?,?> box4 = slide.createAutoShape(); | |||
box4.setShapeType(ShapeType.RIGHT_ARROW); | |||
box4.setFillColor(new Color(187, 224, 227)); | |||
box4.setStrokeStyle(0.75, Color.black); | |||
box4.setAnchor(new Rectangle(253, 288, 198, 85)); | |||
} | |||
public static void slide8(SlideShow<?,?> ppt) throws IOException { | |||
Slide<?,?> slide = ppt.createSlide(); | |||
TextBox<?,?> box1 = slide.createTextBox(); | |||
box1.setTextPlaceholder(TextPlaceholder.TITLE); | |||
box1.setText("Wait, there is more!"); | |||
box1.setAnchor(new Rectangle(36, 21, 648, 90)); | |||
TextBox<?,?> box2 = slide.createTextBox(); | |||
box2.setTextPlaceholder(TextPlaceholder.BODY); | |||
box2.setText( | |||
"Rich text\r" + | |||
"Tables\r" + | |||
"Pictures (JPEG, PNG, BMP, WMF, PICT)\r" + | |||
"Comprehensive formatting features"); | |||
box2.setAnchor(new Rectangle(36, 126, 648, 356)); | |||
} | |||
public static void slide9(SlideShow<?,?> ppt) throws IOException { | |||
Slide<?,?> slide = ppt.createSlide(); | |||
TextBox<?,?> box1 = slide.createTextBox(); | |||
box1.setTextPlaceholder(TextPlaceholder.TITLE); | |||
box1.setText("HSLF in Action - 3"); | |||
box1.setAnchor(new Rectangle(36, 20, 648, 50)); | |||
TextBox<?,?> box2 = slide.createTextBox(); | |||
box2.getTextParagraphs().get(0).getTextRuns().get(0).setFontSize(18d); | |||
box2.setText("PPGraphics2D: PowerPoint Graphics2D driver"); | |||
box2.setAnchor(new Rectangle(178, 70, 387, 30)); | |||
TextBox<?,?> box3 = slide.createTextBox(); | |||
TextRun rt3 = box3.getTextParagraphs().get(0).getTextRuns().get(0); | |||
rt3.setFontFamily("Courier New"); | |||
rt3.setFontSize(8d); | |||
box3.setText( | |||
"//bar chart data. The first value is the bar color, the second is the width\u000b" + | |||
"Object[] def = new Object[]{\u000b" + | |||
" Color.yellow, new Integer(100),\u000b" + | |||
" Color.green, new Integer(150),\u000b" + | |||
" Color.gray, new Integer(75),\u000b" + | |||
" Color.red, new Integer(200),\u000b" + | |||
"};\u000b" + | |||
"\u000b" + | |||
"SlideShow ppt = new SlideShow();\u000b" + | |||
"Slide slide = ppt.createSlide();\u000b" + | |||
"\u000b" + | |||
"ShapeGroup group = new ShapeGroup();\u000b" + | |||
"//define position of the drawing in the slide\u000b" + | |||
"Rectangle bounds = new java.awt.Rectangle(200, 100, 350, 300);\u000b" + | |||
"group.setAnchor(bounds);\u000b" + | |||
"slide.addShape(group);\u000b" + | |||
"Graphics2D graphics = new PPGraphics2D(group);\u000b" + | |||
"\u000b" + | |||
"//draw a simple bar graph\u000b" + | |||
"int x = bounds.x + 50, y = bounds.y + 50;\u000b" + | |||
"graphics.setFont(new Font(\"Arial\", Font.BOLD, 10));\u000b" + | |||
"for (int i = 0, idx = 1; i < def.length; i+=2, idx++) {\u000b" + | |||
" graphics.setColor(Color.black);\u000b" + | |||
" int width = ((Integer)def[i+1]).intValue();\u000b" + | |||
" graphics.drawString(\"Q\" + idx, x-20, y+20);\u000b" + | |||
" graphics.drawString(width + \"%\", x + width + 10, y + 20);\u000b" + | |||
" graphics.setColor((Color)def[i]);\u000b" + | |||
" graphics.fill(new Rectangle(x, y, width, 30));\u000b" + | |||
" y += 40;\u000b" + | |||
"}\u000b" + | |||
"graphics.setColor(Color.black);\u000b" + | |||
"graphics.setFont(new Font(\"Arial\", Font.BOLD, 14));\u000b" + | |||
"graphics.draw(bounds);\u000b" + | |||
"graphics.drawString(\"Performance\", x + 70, y + 40);\u000b" + | |||
"\u000b" + | |||
"FileOutputStream out = new FileOutputStream(\"hslf-demo.ppt\");\u000b" + | |||
"ppt.write(out);\u000b" + | |||
"out.close();"); | |||
box3.setAnchor(new Rectangle(96, 110, 499, 378)); | |||
box3.setHorizontalCentered(true); | |||
} | |||
public static void slide10(SlideShow<?,?> ppt) throws IOException { | |||
//bar chart data. The first value is the bar color, the second is the width | |||
Object[] def = new Object[]{ | |||
Color.yellow, 100, | |||
Color.green, 150, | |||
Color.gray, 75, | |||
Color.red, 200, | |||
}; | |||
Slide<?,?> slide = ppt.createSlide(); | |||
GroupShape<?,?> group = slide.createGroup(); | |||
//define position of the drawing in the slide | |||
Rectangle bounds = new java.awt.Rectangle(200, 100, 350, 300); | |||
group.setAnchor(bounds); | |||
Graphics2D graphics = new SLGraphics(group); | |||
//draw a simple bar graph | |||
int x = bounds.x + 50, y = bounds.y + 50; | |||
graphics.setFont(new Font("Arial", Font.BOLD, 10)); | |||
for (int i = 0, idx = 1; i < def.length; i+=2, idx++) { | |||
graphics.setColor(Color.black); | |||
int width = ((Integer)def[i+1]).intValue(); | |||
graphics.drawString("Q" + idx, x-20, y+20); | |||
graphics.drawString(width + "%", x + width + 10, y + 20); | |||
graphics.setColor((Color)def[i]); | |||
graphics.fill(new Rectangle(x, y, width, 30)); | |||
y += 40; | |||
} | |||
graphics.setColor(Color.black); | |||
graphics.setFont(new Font("Arial", Font.BOLD, 14)); | |||
graphics.draw(bounds); | |||
graphics.drawString("Performance", x + 70, y + 40); | |||
} | |||
public static void slide11(SlideShow<?,?> ppt) throws IOException { | |||
Slide<?,?> slide = ppt.createSlide(); | |||
TextBox<?,?> box1 = slide.createTextBox(); | |||
box1.setTextPlaceholder(TextPlaceholder.TITLE); | |||
box1.setText("HSLF Development Plans"); | |||
box1.setAnchor(new Rectangle(36, 21, 648, 90)); | |||
TextBox<?,?> box2 = slide.createTextBox(); | |||
box2.setTextPlaceholder(TextPlaceholder.BODY); | |||
box2.setText( | |||
"Support for more PowerPoint functionality\r" + | |||
"Rendering slides into java.awt.Graphics2D\r" + | |||
"A way to export slides into images or other formats\r" + | |||
"Integration with Apache FOP - Formatting Objects Processor\r" + | |||
"Transformation of XSL-FO into PPT\r" + | |||
"PPT2PDF transcoder" | |||
); | |||
List<? extends TextParagraph<?,?,?>> tp = box2.getTextParagraphs(); | |||
for (int i : new byte[]{0,1,3}) { | |||
tp.get(i).getTextRuns().get(0).setFontSize(28d); | |||
} | |||
for (int i : new byte[]{2,4,5}) { | |||
tp.get(i).getTextRuns().get(0).setFontSize(24d); | |||
tp.get(i).setIndentLevel(1); | |||
} | |||
box2.setAnchor(new Rectangle(36, 126, 648, 400)); | |||
} | |||
public static void slide12(SlideShow<?,?> ppt) throws IOException { | |||
Slide<?,?> slide = ppt.createSlide(); | |||
TextBox<?,?> box1 = slide.createTextBox(); | |||
box1.setTextPlaceholder(TextPlaceholder.CENTER_TITLE); | |||
box1.setText("Questions?"); | |||
box1.setAnchor(new Rectangle(54, 167, 612, 115)); | |||
TextBox<?,?> box2 = slide.createTextBox(); | |||
box2.setTextPlaceholder(TextPlaceholder.CENTER_BODY); | |||
box2.setText( | |||
"http://poi.apache.org/hslf/\r" + | |||
"http://people.apache.org/~yegor"); | |||
box2.setAnchor(new Rectangle(108, 306, 504, 138)); | |||
} | |||
} |
@@ -1,62 +0,0 @@ | |||
/* ==================================================================== | |||
Licensed to the Apache Software Foundation (ASF) under one or more | |||
contributor license agreements. See the NOTICE file distributed with | |||
this work for additional information regarding copyright ownership. | |||
The ASF licenses this file to You under the Apache License, Version 2.0 | |||
(the "License"); you may not use this file except in compliance with | |||
the License. You may obtain a copy of the License at | |||
http://www.apache.org/licenses/LICENSE-2.0 | |||
Unless required by applicable law or agreed to in writing, software | |||
distributed under the License is distributed on an "AS IS" BASIS, | |||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | |||
See the License for the specific language governing permissions and | |||
limitations under the License. | |||
==================================================================== */ | |||
package org.apache.poi.hslf.examples; | |||
import java.io.FileOutputStream; | |||
import org.apache.poi.hslf.usermodel.HSLFSlide; | |||
import org.apache.poi.hslf.usermodel.HSLFSlideShow; | |||
import org.apache.poi.hslf.usermodel.HSLFTextBox; | |||
import org.apache.poi.hslf.usermodel.HSLFTextParagraph; | |||
/** | |||
* How to create a single-level bulleted list | |||
* and change some of the bullet attributes | |||
* | |||
* @author Yegor Kozlov | |||
*/ | |||
public final class BulletsDemo { | |||
public static void main(String[] args) throws Exception { | |||
HSLFSlideShow ppt = new HSLFSlideShow(); | |||
HSLFSlide slide = ppt.createSlide(); | |||
HSLFTextBox shape = new HSLFTextBox(); | |||
HSLFTextParagraph rt = shape.getTextParagraphs().get(0); | |||
rt.getTextRuns().get(0).setFontSize(42d); | |||
rt.setBullet(true); | |||
rt.setIndent(0d); //bullet offset | |||
rt.setLeftMargin(50d); //text offset (should be greater than bullet offset) | |||
rt.setBulletChar('\u263A'); //bullet character | |||
shape.setText( | |||
"January\r" + | |||
"February\r" + | |||
"March\r" + | |||
"April"); | |||
slide.addShape(shape); | |||
shape.setAnchor(new java.awt.Rectangle(50, 50, 500, 300)); //position of the text box in the slide | |||
slide.addShape(shape); | |||
FileOutputStream out = new FileOutputStream("bullets.ppt"); | |||
ppt.write(out); | |||
out.close(); | |||
} | |||
} |
@@ -1,64 +0,0 @@ | |||
/* ==================================================================== | |||
Licensed to the Apache Software Foundation (ASF) under one or more | |||
contributor license agreements. See the NOTICE file distributed with | |||
this work for additional information regarding copyright ownership. | |||
The ASF licenses this file to You under the Apache License, Version 2.0 | |||
(the "License"); you may not use this file except in compliance with | |||
the License. You may obtain a copy of the License at | |||
http://www.apache.org/licenses/LICENSE-2.0 | |||
Unless required by applicable law or agreed to in writing, software | |||
distributed under the License is distributed on an "AS IS" BASIS, | |||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | |||
See the License for the specific language governing permissions and | |||
limitations under the License. | |||
==================================================================== */ | |||
package org.apache.poi.hslf.examples; | |||
import java.awt.Rectangle; | |||
import java.io.FileOutputStream; | |||
import java.io.IOException; | |||
import org.apache.poi.hslf.usermodel.HSLFHyperlink; | |||
import org.apache.poi.hslf.usermodel.HSLFSlide; | |||
import org.apache.poi.hslf.usermodel.HSLFSlideShow; | |||
import org.apache.poi.hslf.usermodel.HSLFTextBox; | |||
/** | |||
* Demonstrates how to create hyperlinks in PowerPoint presentations | |||
*/ | |||
public abstract class CreateHyperlink { | |||
public static void main(String[] args) throws IOException { | |||
HSLFSlideShow ppt = new HSLFSlideShow(); | |||
HSLFSlide slideA = ppt.createSlide(); | |||
ppt.createSlide(); | |||
HSLFSlide slideC = ppt.createSlide(); | |||
// link to a URL | |||
HSLFTextBox textBox1 = slideA.createTextBox(); | |||
textBox1.setText("Apache POI"); | |||
textBox1.setAnchor(new Rectangle(100, 100, 200, 50)); | |||
HSLFHyperlink link1 = textBox1.getTextParagraphs().get(0).getTextRuns().get(0).createHyperlink(); | |||
link1.linkToUrl("http://www.apache.org"); | |||
link1.setLabel(textBox1.getText()); | |||
// link to another slide | |||
HSLFTextBox textBox2 = slideA.createTextBox(); | |||
textBox2.setText("Go to slide #3"); | |||
textBox2.setAnchor(new Rectangle(100, 300, 200, 50)); | |||
HSLFHyperlink link2 = textBox2.getTextParagraphs().get(0).getTextRuns().get(0).createHyperlink(); | |||
link2.linkToSlide(slideC); | |||
FileOutputStream out = new FileOutputStream("hyperlink.ppt"); | |||
ppt.write(out); | |||
out.close(); | |||
ppt.close(); | |||
} | |||
} |
@@ -1,127 +0,0 @@ | |||
/* ==================================================================== | |||
Licensed to the Apache Software Foundation (ASF) under one or more | |||
contributor license agreements. See the NOTICE file distributed with | |||
this work for additional information regarding copyright ownership. | |||
The ASF licenses this file to You under the Apache License, Version 2.0 | |||
(the "License"); you may not use this file except in compliance with | |||
the License. You may obtain a copy of the License at | |||
http://www.apache.org/licenses/LICENSE-2.0 | |||
Unless required by applicable law or agreed to in writing, software | |||
distributed under the License is distributed on an "AS IS" BASIS, | |||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | |||
See the License for the specific language governing permissions and | |||
limitations under the License. | |||
==================================================================== */ | |||
package org.apache.poi.hslf.examples; | |||
import java.io.FileInputStream; | |||
import java.io.FileOutputStream; | |||
import java.io.InputStream; | |||
import org.apache.poi.hslf.model.OLEShape; | |||
import org.apache.poi.hslf.usermodel.HSLFObjectData; | |||
import org.apache.poi.hslf.usermodel.HSLFPictureData; | |||
import org.apache.poi.hslf.usermodel.HSLFPictureShape; | |||
import org.apache.poi.hslf.usermodel.HSLFShape; | |||
import org.apache.poi.hslf.usermodel.HSLFSlide; | |||
import org.apache.poi.hslf.usermodel.HSLFSlideShow; | |||
import org.apache.poi.hslf.usermodel.HSLFSoundData; | |||
import org.apache.poi.hssf.usermodel.HSSFWorkbook; | |||
import org.apache.poi.hwpf.HWPFDocument; | |||
import org.apache.poi.hwpf.usermodel.Paragraph; | |||
import org.apache.poi.hwpf.usermodel.Range; | |||
/** | |||
* Demonstrates how you can extract misc embedded data from a ppt file | |||
* | |||
* @author Yegor Kozlov | |||
*/ | |||
public final class DataExtraction { | |||
public static void main(String args[]) throws Exception { | |||
if (args.length == 0) { | |||
usage(); | |||
return; | |||
} | |||
FileInputStream is = new FileInputStream(args[0]); | |||
HSLFSlideShow ppt = new HSLFSlideShow(is); | |||
is.close(); | |||
//extract all sound files embedded in this presentation | |||
HSLFSoundData[] sound = ppt.getSoundData(); | |||
for (int i = 0; i < sound.length; i++) { | |||
String type = sound[i].getSoundType(); //*.wav | |||
String name = sound[i].getSoundName(); //typically file name | |||
byte[] data = sound[i].getData(); //raw bytes | |||
//save the sound on disk | |||
FileOutputStream out = new FileOutputStream(name + type); | |||
out.write(data); | |||
out.close(); | |||
} | |||
int oleIdx=-1, picIdx=-1; | |||
for (HSLFSlide slide : ppt.getSlides()) { | |||
//extract embedded OLE documents | |||
for (HSLFShape shape : slide.getShapes()) { | |||
if (shape instanceof OLEShape) { | |||
oleIdx++; | |||
OLEShape ole = (OLEShape) shape; | |||
HSLFObjectData data = ole.getObjectData(); | |||
String name = ole.getInstanceName(); | |||
if ("Worksheet".equals(name)) { | |||
//read xls | |||
@SuppressWarnings({ "unused", "resource" }) | |||
HSSFWorkbook wb = new HSSFWorkbook(data.getData()); | |||
} else if ("Document".equals(name)) { | |||
HWPFDocument doc = new HWPFDocument(data.getData()); | |||
//read the word document | |||
Range r = doc.getRange(); | |||
for(int k = 0; k < r.numParagraphs(); k++) { | |||
Paragraph p = r.getParagraph(k); | |||
System.out.println(p.text()); | |||
} | |||
//save on disk | |||
FileOutputStream out = new FileOutputStream(name + "-("+(oleIdx)+").doc"); | |||
doc.write(out); | |||
out.close(); | |||
} else { | |||
FileOutputStream out = new FileOutputStream(ole.getProgID() + "-"+(oleIdx+1)+".dat"); | |||
InputStream dis = data.getData(); | |||
byte[] chunk = new byte[2048]; | |||
int count; | |||
while ((count = dis.read(chunk)) >= 0) { | |||
out.write(chunk,0,count); | |||
} | |||
is.close(); | |||
out.close(); | |||
} | |||
} | |||
//Pictures | |||
else if (shape instanceof HSLFPictureShape) { | |||
picIdx++; | |||
HSLFPictureShape p = (HSLFPictureShape) shape; | |||
HSLFPictureData data = p.getPictureData(); | |||
String ext = data.getType().extension; | |||
FileOutputStream out = new FileOutputStream("pict-" + picIdx + ext); | |||
out.write(data.getData()); | |||
out.close(); | |||
} | |||
} | |||
} | |||
} | |||
private static void usage(){ | |||
System.out.println("Usage: DataExtraction ppt"); | |||
} | |||
} |
@@ -1,85 +0,0 @@ | |||
/* ==================================================================== | |||
Licensed to the Apache Software Foundation (ASF) under one or more | |||
contributor license agreements. See the NOTICE file distributed with | |||
this work for additional information regarding copyright ownership. | |||
The ASF licenses this file to You under the Apache License, Version 2.0 | |||
(the "License"); you may not use this file except in compliance with | |||
the License. You may obtain a copy of the License at | |||
http://www.apache.org/licenses/LICENSE-2.0 | |||
Unless required by applicable law or agreed to in writing, software | |||
distributed under the License is distributed on an "AS IS" BASIS, | |||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | |||
See the License for the specific language governing permissions and | |||
limitations under the License. | |||
==================================================================== */ | |||
package org.apache.poi.hslf.examples; | |||
import java.awt.Color; | |||
import java.awt.Font; | |||
import java.awt.Graphics2D; | |||
import java.awt.Rectangle; | |||
import java.io.FileOutputStream; | |||
import org.apache.poi.hslf.model.PPGraphics2D; | |||
import org.apache.poi.hslf.usermodel.HSLFGroupShape; | |||
import org.apache.poi.hslf.usermodel.HSLFSlide; | |||
import org.apache.poi.hslf.usermodel.HSLFSlideShow; | |||
/** | |||
* Demonstrates how to draw into a slide using the HSLF Graphics2D driver. | |||
* | |||
* @author Yegor Kozlov | |||
*/ | |||
public final class Graphics2DDemo { | |||
/** | |||
* A simple bar chart demo | |||
*/ | |||
public static void main(String[] args) throws Exception { | |||
HSLFSlideShow ppt = new HSLFSlideShow(); | |||
//bar chart data. The first value is the bar color, the second is the width | |||
Object[] def = new Object[]{ | |||
Color.yellow, 40, | |||
Color.green, 60, | |||
Color.gray, 30, | |||
Color.red, 80, | |||
}; | |||
HSLFSlide slide = ppt.createSlide(); | |||
HSLFGroupShape group = new HSLFGroupShape(); | |||
//define position of the drawing in the slide | |||
Rectangle bounds = new java.awt.Rectangle(200, 100, 350, 300); | |||
group.setAnchor(bounds); | |||
group.setInteriorAnchor(new java.awt.Rectangle(0, 0, 100, 100)); | |||
slide.addShape(group); | |||
Graphics2D graphics = new PPGraphics2D(group); | |||
//draw a simple bar graph | |||
int x = 10, y = 10; | |||
graphics.setFont(new Font("Arial", Font.BOLD, 10)); | |||
for (int i = 0, idx = 1; i < def.length; i+=2, idx++) { | |||
graphics.setColor(Color.black); | |||
int width = ((Integer)def[i+1]).intValue(); | |||
graphics.drawString("Q" + idx, x-5, y+10); | |||
graphics.drawString(width + "%", x + width+3, y + 10); | |||
graphics.setColor((Color)def[i]); | |||
graphics.fill(new Rectangle(x, y, width, 10)); | |||
y += 15; | |||
} | |||
graphics.setColor(Color.black); | |||
graphics.setFont(new Font("Arial", Font.BOLD, 14)); | |||
graphics.draw(group.getInteriorAnchor()); | |||
graphics.drawString("Performance", x + 30, y + 10); | |||
FileOutputStream out = new FileOutputStream("hslf-graphics.ppt"); | |||
ppt.write(out); | |||
out.close(); | |||
ppt.close(); | |||
} | |||
} |
@@ -1,49 +0,0 @@ | |||
/* ==================================================================== | |||
Licensed to the Apache Software Foundation (ASF) under one or more | |||
contributor license agreements. See the NOTICE file distributed with | |||
this work for additional information regarding copyright ownership. | |||
The ASF licenses this file to You under the Apache License, Version 2.0 | |||
(the "License"); you may not use this file except in compliance with | |||
the License. You may obtain a copy of the License at | |||
http://www.apache.org/licenses/LICENSE-2.0 | |||
Unless required by applicable law or agreed to in writing, software | |||
distributed under the License is distributed on an "AS IS" BASIS, | |||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | |||
See the License for the specific language governing permissions and | |||
limitations under the License. | |||
==================================================================== */ | |||
package org.apache.poi.hslf.examples; | |||
import java.io.FileOutputStream; | |||
import java.io.IOException; | |||
import org.apache.poi.hslf.model.HeadersFooters; | |||
import org.apache.poi.hslf.usermodel.HSLFSlideShow; | |||
/** | |||
* Demonstrates how to set headers / footers | |||
*/ | |||
public abstract class HeadersFootersDemo { | |||
public static void main(String[] args) throws IOException { | |||
HSLFSlideShow ppt = new HSLFSlideShow(); | |||
HeadersFooters slideHeaders = ppt.getSlideHeadersFooters(); | |||
slideHeaders.setFootersText("Created by POI-HSLF"); | |||
slideHeaders.setSlideNumberVisible(true); | |||
slideHeaders.setDateTimeText("custom date time"); | |||
HeadersFooters notesHeaders = ppt.getNotesHeadersFooters(); | |||
notesHeaders.setFootersText("My notes footers"); | |||
notesHeaders.setHeaderText("My notes header"); | |||
ppt.createSlide(); | |||
FileOutputStream out = new FileOutputStream("headers_footers.ppt"); | |||
ppt.write(out); | |||
out.close(); | |||
} | |||
} |
@@ -1,83 +0,0 @@ | |||
/* ==================================================================== | |||
Licensed to the Apache Software Foundation (ASF) under one or more | |||
contributor license agreements. See the NOTICE file distributed with | |||
this work for additional information regarding copyright ownership. | |||
The ASF licenses this file to You under the Apache License, Version 2.0 | |||
(the "License"); you may not use this file except in compliance with | |||
the License. You may obtain a copy of the License at | |||
http://www.apache.org/licenses/LICENSE-2.0 | |||
Unless required by applicable law or agreed to in writing, software | |||
distributed under the License is distributed on an "AS IS" BASIS, | |||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | |||
See the License for the specific language governing permissions and | |||
limitations under the License. | |||
==================================================================== */ | |||
package org.apache.poi.hslf.examples; | |||
import java.io.FileInputStream; | |||
import java.util.List; | |||
import java.util.Locale; | |||
import org.apache.poi.hslf.usermodel.HSLFHyperlink; | |||
import org.apache.poi.hslf.usermodel.HSLFShape; | |||
import org.apache.poi.hslf.usermodel.HSLFSimpleShape; | |||
import org.apache.poi.hslf.usermodel.HSLFSlide; | |||
import org.apache.poi.hslf.usermodel.HSLFSlideShow; | |||
import org.apache.poi.hslf.usermodel.HSLFTextParagraph; | |||
import org.apache.poi.hslf.usermodel.HSLFTextRun; | |||
/** | |||
* Demonstrates how to read hyperlinks from a presentation | |||
* | |||
* @author Yegor Kozlov | |||
*/ | |||
public final class Hyperlinks { | |||
public static void main(String[] args) throws Exception { | |||
for (int i = 0; i < args.length; i++) { | |||
FileInputStream is = new FileInputStream(args[i]); | |||
HSLFSlideShow ppt = new HSLFSlideShow(is); | |||
is.close(); | |||
for (HSLFSlide slide : ppt.getSlides()) { | |||
System.out.println("\nslide " + slide.getSlideNumber()); | |||
// read hyperlinks from the slide's text runs | |||
System.out.println("- reading hyperlinks from the text runs"); | |||
for (List<HSLFTextParagraph> paras : slide.getTextParagraphs()) { | |||
for (HSLFTextParagraph para : paras) { | |||
for (HSLFTextRun run : para) { | |||
HSLFHyperlink link = run.getHyperlink(); | |||
if (link != null) { | |||
System.out.println(toStr(link, run.getRawText())); | |||
} | |||
} | |||
} | |||
} | |||
// in PowerPoint you can assign a hyperlink to a shape without text, | |||
// for example to a Line object. The code below demonstrates how to | |||
// read such hyperlinks | |||
System.out.println("- reading hyperlinks from the slide's shapes"); | |||
for (HSLFShape sh : slide.getShapes()) { | |||
if (sh instanceof HSLFSimpleShape) { | |||
HSLFHyperlink link = ((HSLFSimpleShape)sh).getHyperlink(); | |||
if (link != null) { | |||
System.out.println(toStr(link, null)); | |||
} | |||
} | |||
} | |||
} | |||
ppt.close(); | |||
} | |||
} | |||
static String toStr(HSLFHyperlink link, String rawText) { | |||
//in ppt end index is inclusive | |||
String formatStr = "title: %1$s, address: %2$s" + (rawText == null ? "" : ", start: %3$s, end: %4$s, substring: %5$s"); | |||
return String.format(Locale.ROOT, formatStr, link.getLabel(), link.getAddress(), link.getStartIndex(), link.getEndIndex(), rawText); | |||
} | |||
} |
@@ -1,106 +0,0 @@ | |||
/* ==================================================================== | |||
Licensed to the Apache Software Foundation (ASF) under one or more | |||
contributor license agreements. See the NOTICE file distributed with | |||
this work for additional information regarding copyright ownership. | |||
The ASF licenses this file to You under the Apache License, Version 2.0 | |||
(the "License"); you may not use this file except in compliance with | |||
the License. You may obtain a copy of the License at | |||
http://www.apache.org/licenses/LICENSE-2.0 | |||
Unless required by applicable law or agreed to in writing, software | |||
distributed under the License is distributed on an "AS IS" BASIS, | |||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | |||
See the License for the specific language governing permissions and | |||
limitations under the License. | |||
==================================================================== */ | |||
package org.apache.poi.hslf.examples; | |||
import java.awt.Color; | |||
import java.awt.Dimension; | |||
import java.awt.Graphics2D; | |||
import java.awt.RenderingHints; | |||
import java.awt.geom.Rectangle2D; | |||
import java.awt.image.BufferedImage; | |||
import java.io.FileInputStream; | |||
import java.io.FileOutputStream; | |||
import javax.imageio.ImageIO; | |||
import org.apache.poi.hslf.usermodel.HSLFSlide; | |||
import org.apache.poi.hslf.usermodel.HSLFSlideShow; | |||
/** | |||
* Demonstrates how you can use HSLF to convert each slide into a PNG image | |||
* | |||
* @author Yegor Kozlov | |||
*/ | |||
public final class PPT2PNG { | |||
public static void main(String args[]) throws Exception { | |||
if (args.length == 0) { | |||
usage(); | |||
return; | |||
} | |||
int slidenum = -1; | |||
float scale = 1; | |||
String file = null; | |||
for (int i = 0; i < args.length; i++) { | |||
if (args[i].startsWith("-")) { | |||
if ("-scale".equals(args[i])){ | |||
scale = Float.parseFloat(args[++i]); | |||
} else if ("-slide".equals(args[i])) { | |||
slidenum = Integer.parseInt(args[++i]); | |||
} | |||
} else { | |||
file = args[i]; | |||
} | |||
} | |||
if(file == null){ | |||
usage(); | |||
return; | |||
} | |||
FileInputStream is = new FileInputStream(file); | |||
HSLFSlideShow ppt = new HSLFSlideShow(is); | |||
is.close(); | |||
Dimension pgsize = ppt.getPageSize(); | |||
int width = (int)(pgsize.width*scale); | |||
int height = (int)(pgsize.height*scale); | |||
for (HSLFSlide slide : ppt.getSlides()) { | |||
if (slidenum != -1 && slidenum != slide.getSlideNumber()) continue; | |||
String title = slide.getTitle(); | |||
System.out.println("Rendering slide "+slide.getSlideNumber() + (title == null ? "" : ": " + title)); | |||
BufferedImage img = new BufferedImage(width, height, BufferedImage.TYPE_INT_RGB); | |||
Graphics2D graphics = img.createGraphics(); | |||
graphics.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); | |||
graphics.setRenderingHint(RenderingHints.KEY_RENDERING, RenderingHints.VALUE_RENDER_QUALITY); | |||
graphics.setRenderingHint(RenderingHints.KEY_INTERPOLATION, RenderingHints.VALUE_INTERPOLATION_BICUBIC); | |||
graphics.setRenderingHint(RenderingHints.KEY_FRACTIONALMETRICS, RenderingHints.VALUE_FRACTIONALMETRICS_ON); | |||
graphics.setPaint(Color.white); | |||
graphics.fill(new Rectangle2D.Float(0, 0, width, height)); | |||
graphics.scale((double)width/pgsize.width, (double)height/pgsize.height); | |||
slide.draw(graphics); | |||
String fname = file.replaceAll("\\.ppt", "-" + slide.getSlideNumber() + ".png"); | |||
FileOutputStream out = new FileOutputStream(fname); | |||
ImageIO.write(img, "png", out); | |||
out.close(); | |||
} | |||
} | |||
private static void usage(){ | |||
System.out.println("Usage: PPT2PNG [-scale <scale> -slide <num>] ppt"); | |||
} | |||
} |
@@ -1,66 +0,0 @@ | |||
/* ==================================================================== | |||
Licensed to the Apache Software Foundation (ASF) under one or more | |||
contributor license agreements. See the NOTICE file distributed with | |||
this work for additional information regarding copyright ownership. | |||
The ASF licenses this file to You under the Apache License, Version 2.0 | |||
(the "License"); you may not use this file except in compliance with | |||
the License. You may obtain a copy of the License at | |||
http://www.apache.org/licenses/LICENSE-2.0 | |||
Unless required by applicable law or agreed to in writing, software | |||
distributed under the License is distributed on an "AS IS" BASIS, | |||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | |||
See the License for the specific language governing permissions and | |||
limitations under the License. | |||
==================================================================== */ | |||
package org.apache.poi.hslf.examples; | |||
import java.io.FileInputStream; | |||
import java.io.IOException; | |||
import org.apache.poi.hslf.record.InteractiveInfoAtom; | |||
import org.apache.poi.hslf.record.RecordTypes; | |||
import org.apache.poi.hslf.usermodel.HSLFShape; | |||
import org.apache.poi.hslf.usermodel.HSLFSlide; | |||
import org.apache.poi.hslf.usermodel.HSLFSlideShow; | |||
import org.apache.poi.hslf.usermodel.HSLFSoundData; | |||
/** | |||
* For each slide iterate over shapes and found associated sound data. | |||
*/ | |||
public class SoundFinder { | |||
public static void main(String[] args) throws IOException { | |||
FileInputStream fis = new FileInputStream(args[0]); | |||
HSLFSlideShow ppt = new HSLFSlideShow(fis); | |||
HSLFSoundData[] sounds = ppt.getSoundData(); | |||
for (HSLFSlide slide : ppt.getSlides()) { | |||
for (HSLFShape shape : slide.getShapes()) { | |||
int soundRef = getSoundReference(shape); | |||
if(soundRef == -1) continue; | |||
System.out.println("Slide["+slide.getSlideNumber()+"], shape["+shape.getShapeId()+"], soundRef: "+soundRef); | |||
System.out.println(" " + sounds[soundRef].getSoundName()); | |||
System.out.println(" " + sounds[soundRef].getSoundType()); | |||
} | |||
} | |||
ppt.close(); | |||
fis.close(); | |||
} | |||
/** | |||
* Check if a given shape is associated with a sound. | |||
* @return 0-based reference to a sound in the sound collection | |||
* or -1 if the shape is not associated with a sound | |||
*/ | |||
protected static int getSoundReference(HSLFShape shape){ | |||
int soundRef = -1; | |||
//dive into the shape container and search for InteractiveInfoAtom | |||
InteractiveInfoAtom info = shape.getClientDataRecord(RecordTypes.InteractiveInfo.typeID); | |||
if (info != null && info.getAction() == InteractiveInfoAtom.ACTION_MEDIA) { | |||
soundRef = info.getSoundRef(); | |||
} | |||
return soundRef; | |||
} | |||
} |
@@ -1,130 +0,0 @@ | |||
/* ==================================================================== | |||
Licensed to the Apache Software Foundation (ASF) under one or more | |||
contributor license agreements. See the NOTICE file distributed with | |||
this work for additional information regarding copyright ownership. | |||
The ASF licenses this file to You under the Apache License, Version 2.0 | |||
(the "License"); you may not use this file except in compliance with | |||
the License. You may obtain a copy of the License at | |||
http://www.apache.org/licenses/LICENSE-2.0 | |||
Unless required by applicable law or agreed to in writing, software | |||
distributed under the License is distributed on an "AS IS" BASIS, | |||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | |||
See the License for the specific language governing permissions and | |||
limitations under the License. | |||
==================================================================== */ | |||
package org.apache.poi.hslf.examples; | |||
import java.awt.Color; | |||
import java.io.FileOutputStream; | |||
import org.apache.poi.hslf.usermodel.HSLFSlide; | |||
import org.apache.poi.hslf.usermodel.HSLFSlideShow; | |||
import org.apache.poi.hslf.usermodel.HSLFTable; | |||
import org.apache.poi.hslf.usermodel.HSLFTableCell; | |||
import org.apache.poi.hslf.usermodel.HSLFTextRun; | |||
import org.apache.poi.sl.draw.DrawTableShape; | |||
import org.apache.poi.sl.usermodel.TextParagraph.TextAlign; | |||
import org.apache.poi.sl.usermodel.VerticalAlignment; | |||
/** | |||
* Demonstrates how to create tables | |||
* | |||
* @author Yegor Kozlov | |||
*/ | |||
public final class TableDemo { | |||
public static void main(String[] args) throws Exception { | |||
//test data for the first taable | |||
String[][] txt1 = { | |||
{"INPUT FILE", "NUMBER OF RECORDS"}, | |||
{"Item File", "11,559"}, | |||
{"Vendor File", "502"}, | |||
{"Purchase History File - # of PO\u2019s\r(12/01/04 - 05/31/06)", "12,852"}, | |||
{"Purchase History File - # of PO Lines\r(12/01/04 - 05/31/06)", "53,523" }, | |||
{"Total PO History Spend", "$10,172,038"} | |||
}; | |||
HSLFSlideShow ppt = new HSLFSlideShow(); | |||
HSLFSlide slide = ppt.createSlide(); | |||
//six rows, two columns | |||
HSLFTable table1 = slide.createTable(6, 2); | |||
for (int i = 0; i < txt1.length; i++) { | |||
for (int j = 0; j < txt1[i].length; j++) { | |||
HSLFTableCell cell = table1.getCell(i, j); | |||
HSLFTextRun rt = cell.getTextParagraphs().get(0).getTextRuns().get(0); | |||
rt.setFontFamily("Arial"); | |||
rt.setFontSize(10d); | |||
if(i == 0){ | |||
cell.getFill().setForegroundColor(new Color(227, 227, 227)); | |||
} else { | |||
rt.setBold(true); | |||
} | |||
cell.setVerticalAlignment(VerticalAlignment.MIDDLE); | |||
cell.setHorizontalCentered(true); | |||
cell.setText(txt1[i][j]); | |||
} | |||
} | |||
DrawTableShape dts1 = new DrawTableShape(table1); | |||
dts1.setAllBorders(1.0, Color.black); | |||
table1.setColumnWidth(0, 300); | |||
table1.setColumnWidth(1, 150); | |||
int pgWidth = ppt.getPageSize().width; | |||
table1.moveTo((pgWidth - table1.getAnchor().getWidth())/2., 100.); | |||
//test data for the second taable | |||
String[][] txt2 = { | |||
{"Data Source"}, | |||
{"CAS Internal Metrics - Item Master Summary\r" + | |||
"CAS Internal Metrics - Vendor Summary\r" + | |||
"CAS Internal Metrics - PO History Summary"} | |||
}; | |||
//two rows, one column | |||
HSLFTable table2 = slide.createTable(2, 1); | |||
for (int i = 0; i < txt2.length; i++) { | |||
for (int j = 0; j < txt2[i].length; j++) { | |||
HSLFTableCell cell = table2.getCell(i, j); | |||
HSLFTextRun rt = cell.getTextParagraphs().get(0).getTextRuns().get(0); | |||
rt.setFontSize(10d); | |||
rt.setFontFamily("Arial"); | |||
if(i == 0){ | |||
cell.getFill().setForegroundColor(new Color(0, 51, 102)); | |||
rt.setFontColor(Color.white); | |||
rt.setBold(true); | |||
rt.setFontSize(14d); | |||
cell.setHorizontalCentered(true); | |||
} else { | |||
rt.getTextParagraph().setBullet(true); | |||
rt.setFontSize(12d); | |||
rt.getTextParagraph().setTextAlign(TextAlign.LEFT); | |||
cell.setHorizontalCentered(false); | |||
} | |||
cell.setVerticalAlignment(VerticalAlignment.MIDDLE); | |||
cell.setText(txt2[i][j]); | |||
} | |||
} | |||
table2.setColumnWidth(0, 300); | |||
table2.setRowHeight(0, 30); | |||
table2.setRowHeight(1, 70); | |||
DrawTableShape dts2 = new DrawTableShape(table2); | |||
dts2.setOutsideBorders(Color.black, 1.0); | |||
table2.moveTo(200, 400); | |||
FileOutputStream out = new FileOutputStream("hslf-table.ppt"); | |||
ppt.write(out); | |||
out.close(); | |||
ppt.close(); | |||
} | |||
} |
@@ -1,171 +0,0 @@ | |||
/* ==================================================================== | |||
Licensed to the Apache Software Foundation (ASF) under one or more | |||
contributor license agreements. See the NOTICE file distributed with | |||
this work for additional information regarding copyright ownership. | |||
The ASF licenses this file to You under the Apache License, Version 2.0 | |||
(the "License"); you may not use this file except in compliance with | |||
the License. You may obtain a copy of the License at | |||
http://www.apache.org/licenses/LICENSE-2.0 | |||
Unless required by applicable law or agreed to in writing, software | |||
distributed under the License is distributed on an "AS IS" BASIS, | |||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | |||
See the License for the specific language governing permissions and | |||
limitations under the License. | |||
==================================================================== */ | |||
package org.apache.poi.hsmf.examples; | |||
import java.io.File; | |||
import java.io.FileOutputStream; | |||
import java.io.IOException; | |||
import java.io.OutputStream; | |||
import java.io.PrintWriter; | |||
import org.apache.poi.hsmf.MAPIMessage; | |||
import org.apache.poi.hsmf.datatypes.AttachmentChunks; | |||
import org.apache.poi.hsmf.exceptions.ChunkNotFoundException; | |||
/** | |||
* Reads one or several Outlook MSG files and for each of them creates | |||
* a text file from available chunks and a directory that contains | |||
* attachments. | |||
* | |||
* @author Bruno Girin | |||
*/ | |||
public class Msg2txt { | |||
/** | |||
* The stem used to create file names for the text file and the directory | |||
* that contains the attachments. | |||
*/ | |||
private String fileNameStem; | |||
/** | |||
* The Outlook MSG file being processed. | |||
*/ | |||
private MAPIMessage msg; | |||
public Msg2txt(String fileName) throws IOException { | |||
fileNameStem = fileName; | |||
if(fileNameStem.endsWith(".msg") || fileNameStem.endsWith(".MSG")) { | |||
fileNameStem = fileNameStem.substring(0, fileNameStem.length() - 4); | |||
} | |||
msg = new MAPIMessage(fileName); | |||
} | |||
/** | |||
* Processes the message. | |||
* | |||
* @throws IOException if an exception occurs while writing the message out | |||
*/ | |||
public void processMessage() throws IOException { | |||
String txtFileName = fileNameStem + ".txt"; | |||
String attDirName = fileNameStem + "-att"; | |||
PrintWriter txtOut = null; | |||
try { | |||
txtOut = new PrintWriter(txtFileName); | |||
try { | |||
String displayFrom = msg.getDisplayFrom(); | |||
txtOut.println("From: "+displayFrom); | |||
} catch (ChunkNotFoundException e) { | |||
// ignore | |||
} | |||
try { | |||
String displayTo = msg.getDisplayTo(); | |||
txtOut.println("To: "+displayTo); | |||
} catch (ChunkNotFoundException e) { | |||
// ignore | |||
} | |||
try { | |||
String displayCC = msg.getDisplayCC(); | |||
txtOut.println("CC: "+displayCC); | |||
} catch (ChunkNotFoundException e) { | |||
// ignore | |||
} | |||
try { | |||
String displayBCC = msg.getDisplayBCC(); | |||
txtOut.println("BCC: "+displayBCC); | |||
} catch (ChunkNotFoundException e) { | |||
// ignore | |||
} | |||
try { | |||
String subject = msg.getSubject(); | |||
txtOut.println("Subject: "+subject); | |||
} catch (ChunkNotFoundException e) { | |||
// ignore | |||
} | |||
try { | |||
String body = msg.getTextBody(); | |||
txtOut.println(body); | |||
} catch (ChunkNotFoundException e) { | |||
System.err.println("No message body"); | |||
} | |||
AttachmentChunks[] attachments = msg.getAttachmentFiles(); | |||
if(attachments.length > 0) { | |||
File d = new File(attDirName); | |||
if(d.mkdir()) { | |||
for(AttachmentChunks attachment : attachments) { | |||
processAttachment(attachment, d); | |||
} | |||
} else { | |||
System.err.println("Can't create directory "+attDirName); | |||
} | |||
} | |||
} finally { | |||
if(txtOut != null) { | |||
txtOut.close(); | |||
} | |||
} | |||
} | |||
/** | |||
* Processes a single attachment: reads it from the Outlook MSG file and | |||
* writes it to disk as an individual file. | |||
* | |||
* @param attachment the chunk group describing the attachment | |||
* @param dir the directory in which to write the attachment file | |||
* @throws IOException when any of the file operations fails | |||
*/ | |||
public void processAttachment(AttachmentChunks attachment, | |||
File dir) throws IOException { | |||
String fileName = attachment.attachFileName.toString(); | |||
if(attachment.attachLongFileName != null) { | |||
fileName = attachment.attachLongFileName.toString(); | |||
} | |||
File f = new File(dir, fileName); | |||
OutputStream fileOut = null; | |||
try { | |||
fileOut = new FileOutputStream(f); | |||
fileOut.write(attachment.attachData.getValue()); | |||
} finally { | |||
if(fileOut != null) { | |||
fileOut.close(); | |||
} | |||
} | |||
} | |||
/** | |||
* Processes the list of arguments as a list of names of Outlook MSG files. | |||
* | |||
* @param args the list of MSG files to process | |||
*/ | |||
public static void main(String[] args) { | |||
if(args.length <= 0) { | |||
System.err.println("No files names provided"); | |||
} else { | |||
for(int i = 0; i < args.length; i++) { | |||
try { | |||
Msg2txt processor = new Msg2txt(args[i]); | |||
processor.processMessage(); | |||
} catch (IOException e) { | |||
System.err.println("Could not process "+args[i]+": "+e); | |||
} | |||
} | |||
} | |||
} | |||
} |
@@ -1,329 +0,0 @@ | |||
/* ==================================================================== | |||
Licensed to the Apache Software Foundation (ASF) under one or more | |||
contributor license agreements. See the NOTICE file distributed with | |||
this work for additional information regarding copyright ownership. | |||
The ASF licenses this file to You under the Apache License, Version 2.0 | |||
(the "License"); you may not use this file except in compliance with | |||
the License. You may obtain a copy of the License at | |||
http://www.apache.org/licenses/LICENSE-2.0 | |||
Unless required by applicable law or agreed to in writing, software | |||
distributed under the License is distributed on an "AS IS" BASIS, | |||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | |||
See the License for the specific language governing permissions and | |||
limitations under the License. | |||
==================================================================== */ | |||
package org.apache.poi.hssf.eventusermodel.examples; | |||
import java.io.FileInputStream; | |||
import java.io.FileNotFoundException; | |||
import java.io.IOException; | |||
import java.io.PrintStream; | |||
import java.util.ArrayList; | |||
import java.util.List; | |||
import org.apache.poi.hssf.eventusermodel.EventWorkbookBuilder.SheetRecordCollectingListener; | |||
import org.apache.poi.hssf.eventusermodel.FormatTrackingHSSFListener; | |||
import org.apache.poi.hssf.eventusermodel.HSSFEventFactory; | |||
import org.apache.poi.hssf.eventusermodel.HSSFListener; | |||
import org.apache.poi.hssf.eventusermodel.HSSFRequest; | |||
import org.apache.poi.hssf.eventusermodel.MissingRecordAwareHSSFListener; | |||
import org.apache.poi.hssf.eventusermodel.dummyrecord.LastCellOfRowDummyRecord; | |||
import org.apache.poi.hssf.eventusermodel.dummyrecord.MissingCellDummyRecord; | |||
import org.apache.poi.hssf.model.HSSFFormulaParser; | |||
import org.apache.poi.hssf.record.BOFRecord; | |||
import org.apache.poi.hssf.record.BlankRecord; | |||
import org.apache.poi.hssf.record.BoolErrRecord; | |||
import org.apache.poi.hssf.record.BoundSheetRecord; | |||
import org.apache.poi.hssf.record.FormulaRecord; | |||
import org.apache.poi.hssf.record.LabelRecord; | |||
import org.apache.poi.hssf.record.LabelSSTRecord; | |||
import org.apache.poi.hssf.record.NoteRecord; | |||
import org.apache.poi.hssf.record.NumberRecord; | |||
import org.apache.poi.hssf.record.RKRecord; | |||
import org.apache.poi.hssf.record.Record; | |||
import org.apache.poi.hssf.record.SSTRecord; | |||
import org.apache.poi.hssf.record.StringRecord; | |||
import org.apache.poi.hssf.usermodel.HSSFWorkbook; | |||
import org.apache.poi.poifs.filesystem.POIFSFileSystem; | |||
/** | |||
* A XLS -> CSV processor, that uses the MissingRecordAware | |||
* EventModel code to ensure it outputs all columns and rows. | |||
* @author Nick Burch | |||
*/ | |||
public class XLS2CSVmra implements HSSFListener { | |||
private int minColumns; | |||
private POIFSFileSystem fs; | |||
private PrintStream output; | |||
private int lastRowNumber; | |||
private int lastColumnNumber; | |||
/** Should we output the formula, or the value it has? */ | |||
private boolean outputFormulaValues = true; | |||
/** For parsing Formulas */ | |||
private SheetRecordCollectingListener workbookBuildingListener; | |||
private HSSFWorkbook stubWorkbook; | |||
// Records we pick up as we process | |||
private SSTRecord sstRecord; | |||
private FormatTrackingHSSFListener formatListener; | |||
/** So we known which sheet we're on */ | |||
private int sheetIndex = -1; | |||
private BoundSheetRecord[] orderedBSRs; | |||
private List<BoundSheetRecord> boundSheetRecords = new ArrayList<BoundSheetRecord>(); | |||
// For handling formulas with string results | |||
private int nextRow; | |||
private int nextColumn; | |||
private boolean outputNextStringRecord; | |||
/** | |||
* Creates a new XLS -> CSV converter | |||
* @param fs The POIFSFileSystem to process | |||
* @param output The PrintStream to output the CSV to | |||
* @param minColumns The minimum number of columns to output, or -1 for no minimum | |||
*/ | |||
public XLS2CSVmra(POIFSFileSystem fs, PrintStream output, int minColumns) { | |||
this.fs = fs; | |||
this.output = output; | |||
this.minColumns = minColumns; | |||
} | |||
/** | |||
* Creates a new XLS -> CSV converter | |||
* @param filename The file to process | |||
* @param minColumns The minimum number of columns to output, or -1 for no minimum | |||
* @throws IOException | |||
* @throws FileNotFoundException | |||
*/ | |||
public XLS2CSVmra(String filename, int minColumns) throws IOException, FileNotFoundException { | |||
this( | |||
new POIFSFileSystem(new FileInputStream(filename)), | |||
System.out, minColumns | |||
); | |||
} | |||
/** | |||
* Initiates the processing of the XLS file to CSV | |||
*/ | |||
public void process() throws IOException { | |||
MissingRecordAwareHSSFListener listener = new MissingRecordAwareHSSFListener(this); | |||
formatListener = new FormatTrackingHSSFListener(listener); | |||
HSSFEventFactory factory = new HSSFEventFactory(); | |||
HSSFRequest request = new HSSFRequest(); | |||
if(outputFormulaValues) { | |||
request.addListenerForAllRecords(formatListener); | |||
} else { | |||
workbookBuildingListener = new SheetRecordCollectingListener(formatListener); | |||
request.addListenerForAllRecords(workbookBuildingListener); | |||
} | |||
factory.processWorkbookEvents(request, fs); | |||
} | |||
/** | |||
* Main HSSFListener method, processes events, and outputs the | |||
* CSV as the file is processed. | |||
*/ | |||
@Override | |||
public void processRecord(Record record) { | |||
int thisRow = -1; | |||
int thisColumn = -1; | |||
String thisStr = null; | |||
switch (record.getSid()) | |||
{ | |||
case BoundSheetRecord.sid: | |||
boundSheetRecords.add((BoundSheetRecord)record); | |||
break; | |||
case BOFRecord.sid: | |||
BOFRecord br = (BOFRecord)record; | |||
if(br.getType() == BOFRecord.TYPE_WORKSHEET) { | |||
// Create sub workbook if required | |||
if(workbookBuildingListener != null && stubWorkbook == null) { | |||
stubWorkbook = workbookBuildingListener.getStubHSSFWorkbook(); | |||
} | |||
// Output the worksheet name | |||
// Works by ordering the BSRs by the location of | |||
// their BOFRecords, and then knowing that we | |||
// process BOFRecords in byte offset order | |||
sheetIndex++; | |||
if(orderedBSRs == null) { | |||
orderedBSRs = BoundSheetRecord.orderByBofPosition(boundSheetRecords); | |||
} | |||
output.println(); | |||
output.println( | |||
orderedBSRs[sheetIndex].getSheetname() + | |||
" [" + (sheetIndex+1) + "]:" | |||
); | |||
} | |||
break; | |||
case SSTRecord.sid: | |||
sstRecord = (SSTRecord) record; | |||
break; | |||
case BlankRecord.sid: | |||
BlankRecord brec = (BlankRecord) record; | |||
thisRow = brec.getRow(); | |||
thisColumn = brec.getColumn(); | |||
thisStr = ""; | |||
break; | |||
case BoolErrRecord.sid: | |||
BoolErrRecord berec = (BoolErrRecord) record; | |||
thisRow = berec.getRow(); | |||
thisColumn = berec.getColumn(); | |||
thisStr = ""; | |||
break; | |||
case FormulaRecord.sid: | |||
FormulaRecord frec = (FormulaRecord) record; | |||
thisRow = frec.getRow(); | |||
thisColumn = frec.getColumn(); | |||
if(outputFormulaValues) { | |||
if(Double.isNaN( frec.getValue() )) { | |||
// Formula result is a string | |||
// This is stored in the next record | |||
outputNextStringRecord = true; | |||
nextRow = frec.getRow(); | |||
nextColumn = frec.getColumn(); | |||
} else { | |||
thisStr = formatListener.formatNumberDateCell(frec); | |||
} | |||
} else { | |||
thisStr = '"' + | |||
HSSFFormulaParser.toFormulaString(stubWorkbook, frec.getParsedExpression()) + '"'; | |||
} | |||
break; | |||
case StringRecord.sid: | |||
if(outputNextStringRecord) { | |||
// String for formula | |||
StringRecord srec = (StringRecord)record; | |||
thisStr = srec.getString(); | |||
thisRow = nextRow; | |||
thisColumn = nextColumn; | |||
outputNextStringRecord = false; | |||
} | |||
break; | |||
case LabelRecord.sid: | |||
LabelRecord lrec = (LabelRecord) record; | |||
thisRow = lrec.getRow(); | |||
thisColumn = lrec.getColumn(); | |||
thisStr = '"' + lrec.getValue() + '"'; | |||
break; | |||
case LabelSSTRecord.sid: | |||
LabelSSTRecord lsrec = (LabelSSTRecord) record; | |||
thisRow = lsrec.getRow(); | |||
thisColumn = lsrec.getColumn(); | |||
if(sstRecord == null) { | |||
thisStr = '"' + "(No SST Record, can't identify string)" + '"'; | |||
} else { | |||
thisStr = '"' + sstRecord.getString(lsrec.getSSTIndex()).toString() + '"'; | |||
} | |||
break; | |||
case NoteRecord.sid: | |||
NoteRecord nrec = (NoteRecord) record; | |||
thisRow = nrec.getRow(); | |||
thisColumn = nrec.getColumn(); | |||
// TODO: Find object to match nrec.getShapeId() | |||
thisStr = '"' + "(TODO)" + '"'; | |||
break; | |||
case NumberRecord.sid: | |||
NumberRecord numrec = (NumberRecord) record; | |||
thisRow = numrec.getRow(); | |||
thisColumn = numrec.getColumn(); | |||
// Format | |||
thisStr = formatListener.formatNumberDateCell(numrec); | |||
break; | |||
case RKRecord.sid: | |||
RKRecord rkrec = (RKRecord) record; | |||
thisRow = rkrec.getRow(); | |||
thisColumn = rkrec.getColumn(); | |||
thisStr = '"' + "(TODO)" + '"'; | |||
break; | |||
default: | |||
break; | |||
} | |||
// Handle new row | |||
if(thisRow != -1 && thisRow != lastRowNumber) { | |||
lastColumnNumber = -1; | |||
} | |||
// Handle missing column | |||
if(record instanceof MissingCellDummyRecord) { | |||
MissingCellDummyRecord mc = (MissingCellDummyRecord)record; | |||
thisRow = mc.getRow(); | |||
thisColumn = mc.getColumn(); | |||
thisStr = ""; | |||
} | |||
// If we got something to print out, do so | |||
if(thisStr != null) { | |||
if(thisColumn > 0) { | |||
output.print(','); | |||
} | |||
output.print(thisStr); | |||
} | |||
// Update column and row count | |||
if(thisRow > -1) | |||
lastRowNumber = thisRow; | |||
if(thisColumn > -1) | |||
lastColumnNumber = thisColumn; | |||
// Handle end of row | |||
if(record instanceof LastCellOfRowDummyRecord) { | |||
// Print out any missing commas if needed | |||
if(minColumns > 0) { | |||
// Columns are 0 based | |||
if(lastColumnNumber == -1) { lastColumnNumber = 0; } | |||
for(int i=lastColumnNumber; i<(minColumns); i++) { | |||
output.print(','); | |||
} | |||
} | |||
// We're onto a new row | |||
lastColumnNumber = -1; | |||
// End the row | |||
output.println(); | |||
} | |||
} | |||
public static void main(String[] args) throws Exception { | |||
if(args.length < 1) { | |||
System.err.println("Use:"); | |||
System.err.println(" XLS2CSVmra <xls file> [min columns]"); | |||
System.exit(1); | |||
} | |||
int minColumns = -1; | |||
if(args.length >= 2) { | |||
minColumns = Integer.parseInt(args[1]); | |||
} | |||
XLS2CSVmra xls2csv = new XLS2CSVmra(args[0], minColumns); | |||
xls2csv.process(); | |||
} | |||
} |
@@ -1,944 +0,0 @@ | |||
/* ==================================================================== | |||
Licensed to the Apache Software Foundation (ASF) under one or more | |||
contributor license agreements. See the NOTICE file distributed with | |||
this work for additional information regarding copyright ownership. | |||
The ASF licenses this file to You under the Apache License, Version 2.0 | |||
(the "License"); you may not use this file except in compliance with | |||
the License. You may obtain a copy of the License at | |||
http://www.apache.org/licenses/LICENSE-2.0 | |||
Unless required by applicable law or agreed to in writing, software | |||
distributed under the License is distributed on an "AS IS" BASIS, | |||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | |||
See the License for the specific language governing permissions and | |||
limitations under the License. | |||
==================================================================== */ | |||
package org.apache.poi.hssf.usermodel.examples; | |||
import java.io.File; | |||
import java.io.FileInputStream; | |||
import java.io.FileOutputStream; | |||
import java.io.ByteArrayOutputStream; | |||
import java.io.FileNotFoundException; | |||
import java.io.IOException; | |||
import org.apache.poi.hssf.usermodel.HSSFWorkbook; | |||
import org.apache.poi.ss.util.CellReference; | |||
import org.apache.poi.hssf.usermodel.HSSFSheet; | |||
import org.apache.poi.hssf.usermodel.HSSFRow; | |||
import org.apache.poi.hssf.usermodel.HSSFClientAnchor; | |||
import org.apache.poi.hssf.usermodel.HSSFPatriarch; | |||
import org.apache.poi.ss.usermodel.ClientAnchor.AnchorType; | |||
/** | |||
* Demonstrates how to add an image to a worksheet and set that image's size | |||
* to a specific number of milimetres irrespective of the width of the columns | |||
* or height of the rows. Overridden methods are provided so that the location | |||
* of the image - the cells row and column co-ordinates that define the top | |||
* left hand corners of the image - can be identified either in the familiar | |||
* Excel manner - A1 for instance - or using POI's methodolody of a column and | |||
* row index where 0, 0 would indicate cell A1. | |||
* | |||
* The best way to make use of these techniques is to delay adding the image to | |||
* the sheet until all other work has been completed. That way, the sizes of | |||
* all rows and columns will have been adjusted - assuming that step was | |||
* necessary. Even though the anchors type is set to prevent the image moving | |||
* or re-sizing, this setting does not have any effect until the sheet is being | |||
* viewed using the Excel application. | |||
* | |||
* The key to the process is the HSSFClientAnchor class. It accepts eight | |||
* parameters that define, in order; | |||
* | |||
* * How far - in terms of co-ordinate position - the image should be inset | |||
* from the left hand border of a cell. | |||
* * How far - in terms of co-ordinate positions - the image should be inset | |||
* from the from the top of the cell. | |||
* * How far - in terms of co-ordinate positions - the right hand edge of | |||
* the image should protrude into a cell (measured from the cell's left hand | |||
* edge to the image's right hand edge). | |||
* * How far - in terms of co-ordinate positions - the bottm edge of the | |||
* image should protrude into a row (measured from the cell's top edge to | |||
* the image's bottom edge). | |||
* * The index of the column that contains the cell whose top left hand | |||
* corner should be aligned with the top left hand corner of the image. | |||
* * The index of the row that contains the cell whose top left hand corner | |||
* should be aligned with the image's top left hand corner. | |||
* * The index of the column that contains the cell whose top left hand | |||
* corner should be aligned with the image's bottom right hand corner | |||
* * The index number of the row that contains the cell whose top left | |||
* hand corner should be aligned with the images bottom right hand corner. | |||
* | |||
* It can be used to add an image into cell A1, for example, in the following | |||
* manner; | |||
* | |||
* HSSFClientAnchor anchor = new HSSFClientAnchor(0, 0, 0, 0, | |||
* (short)0, 0, (short)1, 1); | |||
* | |||
* The final four parameters determine that the top left hand corner should be | |||
* aligned with the top left hand corner of cell A1 and it's bottom right | |||
* hand corner with the top left hand corner of cell B2. Think of the image as | |||
* being stretched so that it's top left hand corner is aligned with the top | |||
* left hand corner of cell A1 and it's bottom right hand corner is aligned with | |||
* the top left hand corner of cell B1. Interestingly, this would also produce | |||
* the same results; | |||
* | |||
* anchor = new HSSFClientAnchor(0, 0, 1023, 255, | |||
* (short)0, 0, (short)0, 0); | |||
* | |||
* Note that the final four parameters all contain the same value and seem to | |||
* indicate that the images top left hand corner is aligned with the top left | |||
* hand corner of cell A1 and that it's bottom right hand corner is also | |||
* aligned with the top left hand corner of cell A1. Yet, running this code | |||
* would see the image fully occupying cell A1. That is the result of the | |||
* values passed to parameters three and four; these I have referred to as | |||
* determing the images co-ordinates within the cell. They indicate that the | |||
* image should occupy - in order - the full width of the column and the full | |||
* height of the row. | |||
* | |||
* The co-ordinate values shown are the maxima; and they are independent of | |||
* row height/column width and of the font used. Passing 255 will always result | |||
* in the image occupying the full height of the row and passing 1023 will | |||
* always result in the image occupying the full width of the column. They help | |||
* in situations where an image is larger than a column/row and must overlap | |||
* into the next column/row. Using them does mean, however, that it is often | |||
* necessary to perform conversions between Excel's characters units, points, | |||
* pixels and millimetres in order to establish how many rows/columns an image | |||
* should occupy and just what the varous insets ought to be. | |||
* | |||
* Note that the first two parameters of the HSSFClientAchor classes constructor | |||
* are not made use of in the code that follows. It would be fairly trivial | |||
* however to extend these example further and provide methods that would centre | |||
* an image within a cell or allow the user to specify that a plain border a | |||
* fixed number of millimetres wide should wrap around the image. Those first | |||
* two parameters would make this sort of functionality perfectly possible. | |||
* | |||
* Owing to the various conversions used, the actual size of the image may vary | |||
* from that required; testing has so far found this to be in the region of | |||
* plus or minus two millimetres. Most likely by modifying the way the | |||
* calculations are performed - possibly using double(s) throughout and | |||
* rounding the values at the correct point - it is likely that these errors | |||
* could be reduced or removed. | |||
* | |||
* A note concerning Excels' image resizing behaviour. The HSSFClientAnchor | |||
* class contains a method called setAnchorType(int) which can be used to | |||
* determine how Excel will resize an image in reponse to the user increasing | |||
* or decreasing the dimensions of the cell containing the image. There are | |||
* three values that can be passed to this method; 0 = To move and size the | |||
* image with the cell, 2 = To move but don't size the image with the cell, | |||
* 3 = To prevent the image from moving or being resized along with the cell. If | |||
* an image is inserted using this class and placed into a single cell then if | |||
* the setAnchorType(int) method is called and a value of either 0 or 2 passed | |||
* to it, the resultant resizing behaviour may be a surprise. The image will not | |||
* grow in size of the column is made wider or the row higher but it will shrink | |||
* if the columns width or rows height are reduced. | |||
* | |||
* @author Mark Beardsley [msb at apache.org] | |||
* @version 1.00 5th August 2009. | |||
*/ | |||
public class AddDimensionedImage { | |||
// Four constants that determine how - and indeed whether - the rows | |||
// and columns an image may overlie should be expanded to accomodate that | |||
// image. | |||
// Passing EXPAND_ROW will result in the height of a row being increased | |||
// to accomodate the image if it is not already larger. The image will | |||
// be layed across one or more columns. | |||
// Passing EXPAND_COLUMN will result in the width of the column being | |||
// increased to accomodate the image if it is not already larger. The image | |||
// will be layed across one or many rows. | |||
// Passing EXPAND_ROW_AND_COLUMN will result in the height of the row | |||
// bing increased along with the width of the column to accomdate the | |||
// image if either is not already larger. | |||
// Passing OVERLAY_ROW_AND_COLUMN will result in the image being layed | |||
// over one or more rows and columns. No row or column will be resized, | |||
// instead, code will determine how many rows and columns the image should | |||
// overlie. | |||
public static final int EXPAND_ROW = 1; | |||
public static final int EXPAND_COLUMN = 2; | |||
public static final int EXPAND_ROW_AND_COLUMN = 3; | |||
public static final int OVERLAY_ROW_AND_COLUMN = 7; | |||
/** | |||
* Add an image to a worksheet. | |||
* | |||
* @param cellNumber A String that contains the location of the cell whose | |||
* top left hand corner should be aligned with the top | |||
* left hand corner of the image; for example "A1", "A2" | |||
* etc. This is to support the familiar Excel syntax. | |||
* Whilst images are are not actually inserted into cells | |||
* this provides a convenient method of indicating where | |||
* the image should be positioned on the sheet. | |||
* @param sheet A reference to the sheet that contains the cell referenced | |||
* above. | |||
* @param imageFile A String that encapsulates the name of and path to | |||
* the image that is to be 'inserted into' the sheet. | |||
* @param reqImageWidthMM A primitive double that contains the required | |||
* width of the image in millimetres. | |||
* @param reqImageHeightMM A primitive double that contains the required | |||
* height of the image in millimetres. | |||
* @param resizeBehaviour A primitive int whose value will determine how | |||
* the code should react if the image is larger than | |||
* the cell referenced by the cellNumber parameter. | |||
* Four constants are provided to determine what | |||
* should happen; | |||
* AddDimensionedImage.EXPAND_ROW | |||
* AddDimensionedImage.EXPAND_COLUMN | |||
* AddDimensionedImage.EXPAND_ROW_AND_COLUMN | |||
* AddDimensionedImage.OVERLAY_ROW_AND_COLUMN | |||
* @throws java.io.FileNotFoundException If the file containing the image | |||
* cannot be located. | |||
* @throws java.io.IOException If a problem occurs whilst reading the file | |||
* of image data. | |||
* @throws java.lang.IllegalArgumentException If an invalid value is passed | |||
* to the resizeBehaviour | |||
* parameter. | |||
*/ | |||
public void addImageToSheet(String cellNumber, HSSFSheet sheet, | |||
String imageFile, double reqImageWidthMM, double reqImageHeightMM, | |||
int resizeBehaviour) throws IOException, IllegalArgumentException { | |||
// Convert the String into column and row indices then chain the | |||
// call to the overridden addImageToSheet() method. | |||
CellReference cellRef = new CellReference(cellNumber); | |||
this.addImageToSheet(cellRef.getCol(), cellRef.getRow(), sheet, | |||
imageFile, reqImageWidthMM, reqImageHeightMM,resizeBehaviour); | |||
} | |||
/** | |||
* Add an image to a worksheet. | |||
* | |||
* @param colNumber A primitive int that contains the index number of a | |||
* column on the worksheet; POI column indices are zero | |||
* based. Together with the rowNumber parameter's value, | |||
* this parameter identifies a cell on the worksheet. The | |||
* image's top left hand corner will be aligned with the | |||
* top left hand corner of this cell. | |||
* @param rowNumber A primtive int that contains the index number of a row | |||
* on the worksheet; POI row indices are zero based. | |||
* Together with the rowNumber parameter's value, this | |||
* parameter identifies a cell on the worksheet. The | |||
* image's top left hand corner will be aligned with the | |||
* top left hand corner of this cell. | |||
* @param sheet A reference to the sheet that contains the cell identified | |||
* by the two parameters above. | |||
* @param imageFile A String that encapsulates the name of and path to | |||
* the image that is to be 'inserted into' the sheet. | |||
* @param reqImageWidthMM A primitive double that contains the required | |||
* width of the image in millimetres. | |||
* @param reqImageHeightMM A primitive double that contains the required | |||
* height of the image in millimetres. | |||
* @param resizeBehaviour A primitive int whose value will determine how | |||
* the code should react if the image is larger than | |||
* the cell referenced by the colNumber and | |||
* rowNumber parameters. Four constants are provided | |||
* to determine what should happen; | |||
* AddDimensionedImage.EXPAND_ROW | |||
* AddDimensionedImage.EXPAND_COLUMN | |||
* AddDimensionedImage.EXPAND_ROW_AND_COLUMN | |||
* AddDimensionedImage.OVERLAY_ROW_AND_COLUMN | |||
* @throws java.io.FileNotFoundException If the file containing the image | |||
* cannot be located. | |||
* @throws java.io.IOException If a problem occurs whilst reading the file | |||
* of image data. | |||
* @throws java.lang.IllegalArgumentException If an invalid value is passed | |||
* to the resizeBehaviour | |||
* parameter. | |||
*/ | |||
private void addImageToSheet(int colNumber, int rowNumber, HSSFSheet sheet, | |||
String imageFile, double reqImageWidthMM, double reqImageHeightMM, | |||
int resizeBehaviour) throws FileNotFoundException, IOException, | |||
IllegalArgumentException { | |||
HSSFClientAnchor anchor = null; | |||
HSSFPatriarch patriarch = null; | |||
ClientAnchorDetail rowClientAnchorDetail = null; | |||
ClientAnchorDetail colClientAnchorDetail = null; | |||
// Validate the resizeBehaviour parameter. | |||
if((resizeBehaviour != AddDimensionedImage.EXPAND_COLUMN) && | |||
(resizeBehaviour != AddDimensionedImage.EXPAND_ROW) && | |||
(resizeBehaviour != AddDimensionedImage.EXPAND_ROW_AND_COLUMN) && | |||
(resizeBehaviour != AddDimensionedImage.OVERLAY_ROW_AND_COLUMN)) { | |||
throw new IllegalArgumentException("Invalid value passed to the " + | |||
"resizeBehaviour parameter of AddDimensionedImage.addImageToSheet()"); | |||
} | |||
// Call methods to calculate how the image and sheet should be | |||
// manipulated to accomodate the image; columns and then rows. | |||
colClientAnchorDetail = this.fitImageToColumns(sheet, colNumber, | |||
reqImageWidthMM, resizeBehaviour); | |||
rowClientAnchorDetail = this.fitImageToRows(sheet, rowNumber, | |||
reqImageHeightMM, resizeBehaviour); | |||
// Having determined if and how to resize the rows, columns and/or the | |||
// image, create the HSSFClientAnchor object to position the image on | |||
// the worksheet. Note how the two ClientAnchorDetail records are | |||
// interrogated to recover the row/column co-ordinates and any insets. | |||
// The first two parameters are not used currently but could be if the | |||
// need arose to extend the functionality of this code by adding the | |||
// ability to specify that a clear 'border' be placed around the image. | |||
anchor = new HSSFClientAnchor(0, | |||
0, | |||
colClientAnchorDetail.getInset(), | |||
rowClientAnchorDetail.getInset(), | |||
(short)colClientAnchorDetail.getFromIndex(), | |||
rowClientAnchorDetail.getFromIndex(), | |||
(short)colClientAnchorDetail.getToIndex(), | |||
rowClientAnchorDetail.getToIndex()); | |||
// For now, set the anchor type to do not move or resize the | |||
// image as the size of the row/column is adjusted. This could easilly | |||
// become another parameter passed to the method. | |||
//anchor.setAnchorType(HSSFClientAnchor.DONT_MOVE_AND_RESIZE); | |||
anchor.setAnchorType(AnchorType.MOVE_AND_RESIZE); | |||
// Now, add the picture to the workbook. Note that the type is assumed | |||
// to be a JPEG/JPG, this could easily (and should) be parameterised | |||
// however. | |||
//int index = sheet.getWorkbook().addPicture(this.imageToBytes(imageFile), | |||
// HSSFWorkbook.PICTURE_TYPE_JPEG); | |||
int index = sheet.getWorkbook().addPicture(this.imageToBytes(imageFile), HSSFWorkbook.PICTURE_TYPE_PNG); | |||
// Get the drawing patriarch and create the picture. | |||
patriarch = sheet.createDrawingPatriarch(); | |||
patriarch.createPicture(anchor, index); | |||
} | |||
/** | |||
* Determines whether the sheets columns should be re-sized to accomodate | |||
* the image, adjusts the columns width if necessary and creates then | |||
* returns a ClientAnchorDetail object that facilitates construction of | |||
* an HSSFClientAnchor that will fix the image on the sheet and establish | |||
* it's size. | |||
* | |||
* @param sheet A reference to the sheet that will 'contain' the image. | |||
* @param colNumber A primtive int that contains the index number of a | |||
* column on the sheet. | |||
* @param reqImageWidthMM A primtive double that contains the required | |||
* width of the image in millimetres | |||
* @param resizeBehaviour A primitve int whose value will indicate how the | |||
* width of the column should be adjusted if the | |||
* required width of the image is greater than the | |||
* width of the column. | |||
* @return An instance of the ClientAnchorDetail class that will contain | |||
* the index number of the column containing the cell whose top | |||
* left hand corner also defines the top left hand corner of the | |||
* image, the index number column containing the cell whose top | |||
* left hand corner also defines the bottom right hand corner of | |||
* the image and an inset that determines how far the right hand | |||
* edge of the image can protrude into the next column - expressed | |||
* as a specific number of co-ordinate positions. | |||
*/ | |||
private ClientAnchorDetail fitImageToColumns(HSSFSheet sheet, int colNumber, | |||
double reqImageWidthMM, int resizeBehaviour) { | |||
double colWidthMM = 0.0D; | |||
double colCoordinatesPerMM = 0.0D; | |||
int pictureWidthCoordinates = 0; | |||
ClientAnchorDetail colClientAnchorDetail = null; | |||
// Get the colum's width in millimetres | |||
colWidthMM = ConvertImageUnits.widthUnits2Millimetres( | |||
(short)sheet.getColumnWidth(colNumber)); | |||
// Check that the column's width will accomodate the image at the | |||
// required dimension. If the width of the column is LESS than the | |||
// required width of the image, decide how the application should | |||
// respond - resize the column or overlay the image across one or more | |||
// columns. | |||
if(colWidthMM < reqImageWidthMM) { | |||
// Should the column's width simply be expanded? | |||
if((resizeBehaviour == AddDimensionedImage.EXPAND_COLUMN) || | |||
(resizeBehaviour == AddDimensionedImage.EXPAND_ROW_AND_COLUMN)) { | |||
// Set the width of the column by converting the required image | |||
// width from millimetres into Excel's column width units. | |||
sheet.setColumnWidth(colNumber, | |||
ConvertImageUnits.millimetres2WidthUnits(reqImageWidthMM)); | |||
// To make the image occupy the full width of the column, convert | |||
// the required width of the image into co-ordinates. This value | |||
// will become the inset for the ClientAnchorDetail class that | |||
// is then instantiated. | |||
colWidthMM = reqImageWidthMM; | |||
colCoordinatesPerMM = ConvertImageUnits.TOTAL_COLUMN_COORDINATE_POSITIONS / | |||
colWidthMM; | |||
pictureWidthCoordinates = (int)(reqImageWidthMM * colCoordinatesPerMM); | |||
colClientAnchorDetail = new ClientAnchorDetail(colNumber, | |||
colNumber, pictureWidthCoordinates); | |||
} | |||
// If the user has chosen to overlay both rows and columns or just | |||
// to expand ONLY the size of the rows, then calculate how to lay | |||
// the image out across one or more columns. | |||
else if ((resizeBehaviour == AddDimensionedImage.OVERLAY_ROW_AND_COLUMN) || | |||
(resizeBehaviour == AddDimensionedImage.EXPAND_ROW)) { | |||
colClientAnchorDetail = this.calculateColumnLocation(sheet, | |||
colNumber, reqImageWidthMM); | |||
} | |||
} | |||
// If the column is wider than the image. | |||
else { | |||
// Mow many co-ordinate positions are there per millimetre? | |||
colCoordinatesPerMM = ConvertImageUnits.TOTAL_COLUMN_COORDINATE_POSITIONS / | |||
colWidthMM; | |||
// Given the width of the image, what should be it's co-ordinate? | |||
pictureWidthCoordinates = (int)(reqImageWidthMM * colCoordinatesPerMM); | |||
colClientAnchorDetail = new ClientAnchorDetail(colNumber, | |||
colNumber, pictureWidthCoordinates); | |||
} | |||
return(colClientAnchorDetail); | |||
} | |||
/** | |||
* Determines whether the sheet's row should be re-sized to accomodate | |||
* the image, adjusts the rows height if necessary and creates then | |||
* returns a ClientAnchorDetail object that facilitates construction of | |||
* an HSSFClientAnchor that will fix the image on the sheet and establish | |||
* it's size. | |||
* | |||
* @param sheet A reference to the sheet that will 'contain' the image. | |||
* @param rowNumber A primtive int that contains the index number of a | |||
* row on the sheet. | |||
* @param reqImageHeightMM A primtive double that contains the required | |||
* height of the image in millimetres | |||
* @param resizeBehaviour A primitve int whose value will indicate how the | |||
* height of the row should be adjusted if the | |||
* required height of the image is greater than the | |||
* height of the row. | |||
* @return An instance of the ClientAnchorDetail class that will contain | |||
* the index number of the row containing the cell whose top | |||
* left hand corner also defines the top left hand corner of the | |||
* image, the index number of the row containing the cell whose | |||
* top left hand corner also defines the bottom right hand | |||
* corner of the image and an inset that determines how far the | |||
* bottom edge of the image can protrude into the next (lower) | |||
* row - expressed as a specific number of co-ordinate positions. | |||
*/ | |||
private ClientAnchorDetail fitImageToRows(HSSFSheet sheet, int rowNumber, | |||
double reqImageHeightMM, int resizeBehaviour) { | |||
HSSFRow row = null; | |||
double rowHeightMM = 0.0D; | |||
double rowCoordinatesPerMM = 0.0D; | |||
int pictureHeightCoordinates = 0; | |||
ClientAnchorDetail rowClientAnchorDetail = null; | |||
// Get the row and it's height | |||
row = sheet.getRow(rowNumber); | |||
if(row == null) { | |||
// Create row if it does not exist. | |||
row = sheet.createRow(rowNumber); | |||
} | |||
// Get the row's height in millimetres | |||
rowHeightMM = row.getHeightInPoints() / ConvertImageUnits.POINTS_PER_MILLIMETRE; | |||
// Check that the row's height will accomodate the image at the required | |||
// dimensions. If the height of the row is LESS than the required height | |||
// of the image, decide how the application should respond - resize the | |||
// row or overlay the image across a series of rows. | |||
if(rowHeightMM < reqImageHeightMM) { | |||
if((resizeBehaviour == AddDimensionedImage.EXPAND_ROW) || | |||
(resizeBehaviour == AddDimensionedImage.EXPAND_ROW_AND_COLUMN)) { | |||
row.setHeightInPoints((float)(reqImageHeightMM * | |||
ConvertImageUnits.POINTS_PER_MILLIMETRE)); | |||
rowHeightMM = reqImageHeightMM; | |||
rowCoordinatesPerMM = ConvertImageUnits.TOTAL_ROW_COORDINATE_POSITIONS / | |||
rowHeightMM; | |||
pictureHeightCoordinates = (int)(reqImageHeightMM * rowCoordinatesPerMM); | |||
rowClientAnchorDetail = new ClientAnchorDetail(rowNumber, | |||
rowNumber, pictureHeightCoordinates); | |||
} | |||
// If the user has chosen to overlay both rows and columns or just | |||
// to expand ONLY the size of the columns, then calculate how to lay | |||
// the image out ver one or more rows. | |||
else if((resizeBehaviour == AddDimensionedImage.OVERLAY_ROW_AND_COLUMN) || | |||
(resizeBehaviour == AddDimensionedImage.EXPAND_COLUMN)) { | |||
rowClientAnchorDetail = this.calculateRowLocation(sheet, | |||
rowNumber, reqImageHeightMM); | |||
} | |||
} | |||
// Else, if the image is smaller than the space available | |||
else { | |||
rowCoordinatesPerMM = ConvertImageUnits.TOTAL_ROW_COORDINATE_POSITIONS / | |||
rowHeightMM; | |||
pictureHeightCoordinates = (int)(reqImageHeightMM * rowCoordinatesPerMM); | |||
rowClientAnchorDetail = new ClientAnchorDetail(rowNumber, | |||
rowNumber, pictureHeightCoordinates); | |||
} | |||
return(rowClientAnchorDetail); | |||
} | |||
/** | |||
* If the image is to overlie more than one column, calculations need to be | |||
* performed to determine how many columns and whether the image will | |||
* overlie just a part of one column in order to be presented at the | |||
* required size. | |||
* | |||
* @param sheet The sheet that will 'contain' the image. | |||
* @param startingColumn A primitive int whose value is the index of the | |||
* column that contains the cell whose top left hand | |||
* corner should be aligned with the top left hand | |||
* corner of the image. | |||
* @param reqImageWidthMM A primitive double whose value will indicate the | |||
* required width of the image in millimetres. | |||
* @return An instance of the ClientAnchorDetail class that will contain | |||
* the index number of the column containing the cell whose top | |||
* left hand corner also defines the top left hand corner of the | |||
* image, the index number column containing the cell whose top | |||
* left hand corner also defines the bottom right hand corner of | |||
* the image and an inset that determines how far the right hand | |||
* edge of the image can protrude into the next column - expressed | |||
* as a specific number of co-ordinate positions. | |||
*/ | |||
private ClientAnchorDetail calculateColumnLocation(HSSFSheet sheet, | |||
int startingColumn, | |||
double reqImageWidthMM) { | |||
ClientAnchorDetail anchorDetail = null; | |||
double totalWidthMM = 0.0D; | |||
double colWidthMM = 0.0D; | |||
double overlapMM = 0.0D; | |||
double coordinatePositionsPerMM = 0.0D; | |||
int toColumn = startingColumn; | |||
int inset = 0; | |||
// Calculate how many columns the image will have to | |||
// span in order to be presented at the required size. | |||
while(totalWidthMM < reqImageWidthMM) { | |||
colWidthMM = ConvertImageUnits.widthUnits2Millimetres( | |||
(short)(sheet.getColumnWidth(toColumn))); | |||
// Note use of the cell border width constant. Testing with an image | |||
// declared to fit exactly into one column demonstrated that it's | |||
// width was greater than the width of the column the POI returned. | |||
// Further, this difference was a constant value that I am assuming | |||
// related to the cell's borders. Either way, that difference needs | |||
// to be allowed for in this calculation. | |||
totalWidthMM += (colWidthMM + ConvertImageUnits.CELL_BORDER_WIDTH_MILLIMETRES); | |||
toColumn++; | |||
} | |||
// De-crement by one the last column value. | |||
toColumn--; | |||
// Highly unlikely that this will be true but, if the width of a series | |||
// of columns is exactly equal to the required width of the image, then | |||
// simply build a ClientAnchorDetail object with an inset equal to the | |||
// total number of co-ordinate positions available in a column, a | |||
// from column co-ordinate (top left hand corner) equal to the value | |||
// of the startingColumn parameter and a to column co-ordinate equal | |||
// to the toColumn variable. | |||
// | |||
// Convert both values to ints to perform the test. | |||
if((int)totalWidthMM == (int)reqImageWidthMM) { | |||
// A problem could occur if the image is sized to fit into one or | |||
// more columns. If that occurs, the value in the toColumn variable | |||
// will be in error. To overcome this, there are two options, to | |||
// ibcrement the toColumn variable's value by one or to pass the | |||
// total number of co-ordinate positions to the third paramater | |||
// of the ClientAnchorDetail constructor. For no sepcific reason, | |||
// the latter option is used below. | |||
anchorDetail = new ClientAnchorDetail(startingColumn, | |||
toColumn, ConvertImageUnits.TOTAL_COLUMN_COORDINATE_POSITIONS); | |||
} | |||
// In this case, the image will overlap part of another column and it is | |||
// necessary to calculate just how much - this will become the inset | |||
// for the ClientAnchorDetail object. | |||
else { | |||
// Firstly, claculate how much of the image should overlap into | |||
// the next column. | |||
overlapMM = reqImageWidthMM - (totalWidthMM - colWidthMM); | |||
// When the required size is very close indded to the column size, | |||
// the calcaulation above can produce a negative value. To prevent | |||
// problems occuring in later caculations, this is simply removed | |||
// be setting the overlapMM value to zero. | |||
if(overlapMM < 0) { | |||
overlapMM = 0.0D; | |||
} | |||
// Next, from the columns width, calculate how many co-ordinate | |||
// positons there are per millimetre | |||
coordinatePositionsPerMM = ConvertImageUnits.TOTAL_COLUMN_COORDINATE_POSITIONS / | |||
colWidthMM; | |||
// From this figure, determine how many co-ordinat positions to | |||
// inset the left hand or bottom edge of the image. | |||
inset = (int)(coordinatePositionsPerMM * overlapMM); | |||
// Now create the ClientAnchorDetail object, setting the from and to | |||
// columns and the inset. | |||
anchorDetail = new ClientAnchorDetail(startingColumn, toColumn, inset); | |||
} | |||
return(anchorDetail); | |||
} | |||
/** | |||
* If the image is to overlie more than one rows, calculations need to be | |||
* performed to determine how many rows and whether the image will | |||
* overlie just a part of one row in order to be presented at the | |||
* required size. | |||
* | |||
* @param sheet The sheet that will 'contain' the image. | |||
* @param startingRow A primitive int whose value is the index of the row | |||
* that contains the cell whose top left hand corner | |||
* should be aligned with the top left hand corner of | |||
* the image. | |||
* @param reqImageHeightMM A primitive double whose value will indicate the | |||
* required height of the image in millimetres. | |||
* @return An instance of the ClientAnchorDetail class that will contain | |||
* the index number of the row containing the cell whose top | |||
* left hand corner also defines the top left hand corner of the | |||
* image, the index number of the row containing the cell whose top | |||
* left hand corner also defines the bottom right hand corner of | |||
* the image and an inset that determines how far the bottom edge | |||
* can protrude into the next (lower) row - expressed as a specific | |||
* number of co-ordinate positions. | |||
*/ | |||
private ClientAnchorDetail calculateRowLocation(HSSFSheet sheet, | |||
int startingRow, double reqImageHeightMM) { | |||
ClientAnchorDetail clientAnchorDetail = null; | |||
HSSFRow row = null; | |||
double rowHeightMM = 0.0D; | |||
double totalRowHeightMM = 0.0D; | |||
double overlapMM = 0.0D; | |||
double rowCoordinatesPerMM = 0.0D; | |||
int toRow = startingRow; | |||
int inset = 0; | |||
// Step through the rows in the sheet and accumulate a total of their | |||
// heights. | |||
while(totalRowHeightMM < reqImageHeightMM) { | |||
row = sheet.getRow(toRow); | |||
// Note, if the row does not already exist on the sheet then create | |||
// it here. | |||
if(row == null) { | |||
row = sheet.createRow(toRow); | |||
} | |||
// Get the row's height in millimetres and add to the running total. | |||
rowHeightMM = row.getHeightInPoints() / | |||
ConvertImageUnits.POINTS_PER_MILLIMETRE; | |||
totalRowHeightMM += rowHeightMM; | |||
toRow++; | |||
} | |||
// Owing to the way the loop above works, the rowNumber will have been | |||
// incremented one row too far. Undo that here. | |||
toRow--; | |||
// Check to see whether the image should occupy an exact number of | |||
// rows. If so, build the ClientAnchorDetail record to point | |||
// to those rows and with an inset of the total number of co-ordinate | |||
// position in the row. | |||
// | |||
// To overcome problems that can occur with comparing double values for | |||
// equality, cast both to int(s) to truncate the value; VERY crude and | |||
// I do not really like it!! | |||
if((int)totalRowHeightMM == (int)reqImageHeightMM) { | |||
clientAnchorDetail = new ClientAnchorDetail(startingRow, toRow, | |||
ConvertImageUnits.TOTAL_ROW_COORDINATE_POSITIONS); | |||
} | |||
else { | |||
// Calculate how far the image will project into the next row. Note | |||
// that the height of the last row assessed is subtracted from the | |||
// total height of all rows assessed so far. | |||
overlapMM = reqImageHeightMM - (totalRowHeightMM - rowHeightMM); | |||
// To prevent an exception being thrown when the required width of | |||
// the image is very close indeed to the column size. | |||
if(overlapMM < 0) { | |||
overlapMM = 0.0D; | |||
} | |||
rowCoordinatesPerMM = ConvertImageUnits.TOTAL_ROW_COORDINATE_POSITIONS / | |||
rowHeightMM; | |||
inset = (int)(overlapMM * rowCoordinatesPerMM); | |||
clientAnchorDetail = new ClientAnchorDetail(startingRow, | |||
toRow, inset); | |||
} | |||
return(clientAnchorDetail); | |||
} | |||
/** | |||
* Loads - reads in and converts into an array of byte(s) - an image from | |||
* a named file. | |||
* | |||
* Note: this method should be modified so that the type of the image may | |||
* also be passed to it. Currently, it assumes that all images are | |||
* JPG/JPEG(s). | |||
* | |||
* @param imageFilename A String that encapsulates the path to and name | |||
* of the file that contains the image which is to be | |||
* 'loaded'. | |||
* @return An array of type byte that contains the raw data of the named | |||
* image. | |||
* @throws java.io.FileNotFoundException Thrown if it was not possible to | |||
* open the specified file. | |||
* @throws java.io.IOException Thrown if reading the file failed or was | |||
* interrupted. | |||
*/ | |||
private byte[] imageToBytes(String imageFilename) throws IOException { | |||
File imageFile = null; | |||
FileInputStream fis = null; | |||
ByteArrayOutputStream bos = null; | |||
int read = 0; | |||
try { | |||
imageFile = new File(imageFilename); | |||
fis = new FileInputStream(imageFile); | |||
bos = new ByteArrayOutputStream(); | |||
while((read = fis.read()) != -1) { | |||
bos.write(read); | |||
} | |||
return(bos.toByteArray()); | |||
} | |||
finally { | |||
if(fis != null) { | |||
try { | |||
fis.close(); | |||
fis = null; | |||
} | |||
catch(IOException ioEx) { | |||
// Nothing to do here | |||
} | |||
} | |||
} | |||
} | |||
/** | |||
* The main entry point to the program. It contains code that demonstrates | |||
* one way to use the program. | |||
* | |||
* Note, the code is not restricted to use on new workbooks only. If an | |||
* image is to be inserted into an existing workbook. just open that | |||
* workbook, gat a reference to a sheet and pass that; | |||
* | |||
* AddDimensionedImage addImage = new AddDimensionedImage(); | |||
* | |||
* File file = new File("....... Existing Workbook ......."); | |||
* FileInputStream fis = new FileInputStream(file); | |||
* HSSFWorkbook workbook = new HSSFWorkbook(fis); | |||
* HSSFSheet sheet = workbook.getSheetAt(0); | |||
* addImage.addImageToSheet("C3", sheet, "image.jpg", 30, 20, | |||
* AddDimensionedImage.EXPAND.ROW); | |||
* | |||
* @param args the command line arguments | |||
*/ | |||
public static void main(String[] args) { | |||
String imageFile = null; | |||
String outputFile = null; | |||
FileOutputStream fos = null; | |||
HSSFSheet sheet = null; | |||
try { | |||
if(args.length < 2){ | |||
System.err.println("Usage: AddDimensionedImage imageFile outputFile"); | |||
return; | |||
} | |||
imageFile = args[0]; | |||
outputFile = args[1]; | |||
HSSFWorkbook workbook = new HSSFWorkbook(); | |||
sheet = workbook.createSheet("Picture Test"); | |||
new AddDimensionedImage().addImageToSheet("A1", sheet, | |||
imageFile, 125, 125, | |||
AddDimensionedImage.EXPAND_ROW_AND_COLUMN); | |||
fos = new FileOutputStream(outputFile); | |||
workbook.write(fos); | |||
workbook.close(); | |||
} | |||
catch(FileNotFoundException fnfEx) { | |||
System.out.println("Caught an: " + fnfEx.getClass().getName()); | |||
System.out.println("Message: " + fnfEx.getMessage()); | |||
System.out.println("Stacktrace follows..........."); | |||
fnfEx.printStackTrace(System.out); | |||
} | |||
catch(IOException ioEx) { | |||
System.out.println("Caught an: " + ioEx.getClass().getName()); | |||
System.out.println("Message: " + ioEx.getMessage()); | |||
System.out.println("Stacktrace follows..........."); | |||
ioEx.printStackTrace(System.out); | |||
} | |||
finally { | |||
try { | |||
if(fos != null) { | |||
fos.close(); | |||
fos = null; | |||
} | |||
} catch(IOException ioEx) { | |||
// I G N O R E | |||
} | |||
} | |||
} | |||
/** | |||
* The HSSFClientAnchor class accepts eight parameters. In order, these are; | |||
* | |||
* * How far the left hand edge of the image is inset from the left hand | |||
* edge of the cell | |||
* * How far the top edge of the image is inset from the top of the cell | |||
* * How far the right hand edge of the image is inset from the left | |||
* hand edge of the cell | |||
* * How far the bottom edge of the image is inset from the top of the | |||
* cell. | |||
* * Together, parameters five and six determine the column and row | |||
* co-ordinates of the cell whose top left hand corner will be aligned | |||
* with the image's top left hand corner. | |||
* * Together, parameter seven and eight determine the column and row | |||
* co-ordinates of the cell whose top left hand corner will be aligned | |||
* with the images bottom right hand corner. | |||
* | |||
* An instance of the ClientAnchorDetail class provides three of the eight | |||
* parameters, one of the co-ordinates for the images top left hand corner, | |||
* one of the co-ordinates for the images bottom right hand corner and | |||
* either how far the image should be inset from the top or the left hand | |||
* edge of the cell. | |||
* | |||
* @author Mark Beardsley [mas at apache.org] | |||
* @version 1.00 5th August 2009. | |||
*/ | |||
public class ClientAnchorDetail { | |||
public int fromIndex = 0; | |||
public int toIndex = 0; | |||
public int inset = 0; | |||
/** | |||
* Create a new instance of the ClientAnchorDetail class using the | |||
* following parameters. | |||
* | |||
* @param fromIndex A primitive int that contains one of the | |||
* co-ordinates (row or column index) for the top left | |||
* hand corner of the image. | |||
* @param toIndex A primitive int that contains one of the | |||
* co-ordinates (row or column index) for the bottom | |||
* right hand corner of the image. | |||
* @param inset A primitive int that contains a value which indicates | |||
* how far the image should be inset from the top or the | |||
* left hand edge of a cell. | |||
*/ | |||
public ClientAnchorDetail(int fromIndex, int toIndex, int inset) { | |||
this.fromIndex = fromIndex; | |||
this.toIndex = toIndex; | |||
this.inset = inset; | |||
} | |||
/** | |||
* Get one of the number of the column or row that contains the cell | |||
* whose top left hand corner will be aligned with the top left hand | |||
* corner of the image. | |||
* | |||
* @return The value - row or column index - for one of the co-ordinates | |||
* of the top left hand corner of the image. | |||
*/ | |||
public int getFromIndex() { | |||
return(this.fromIndex); | |||
} | |||
/** | |||
* Get one of the number of the column or row that contains the cell | |||
* whose top left hand corner will be aligned with the bottom righ hand | |||
* corner of the image. | |||
* | |||
* @return The value - row or column index - for one of the co-ordinates | |||
* of the bottom right hand corner of the image. | |||
*/ | |||
public int getToIndex() { | |||
return(this.toIndex); | |||
} | |||
/** | |||
* Get the image's offset from the edge of a cell. | |||
* | |||
* @return How far either the right hand or bottom edge of the image is | |||
* inset from the left hand or top edge of a cell. | |||
*/ | |||
public int getInset() { | |||
return(this.inset); | |||
} | |||
} | |||
/** | |||
* Utility methods used to convert Excel's character based column and row | |||
* size measurements into pixels and/or millimetres. The class also contains | |||
* various constants that are required in other calculations. | |||
* | |||
* @author xio[darjino@hotmail.com] | |||
* @version 1.01 30th July 2009. | |||
* Added by Mark Beardsley [msb at apache.org]. | |||
* Additional constants. | |||
* widthUnits2Millimetres() and millimetres2Units() methods. | |||
*/ | |||
public static class ConvertImageUnits { | |||
// Each cell conatins a fixed number of co-ordinate points; this number | |||
// does not vary with row height or column width or with font. These two | |||
// constants are defined below. | |||
public static final int TOTAL_COLUMN_COORDINATE_POSITIONS = 1023; // MB | |||
public static final int TOTAL_ROW_COORDINATE_POSITIONS = 255; // MB | |||
// The resoultion of an image can be expressed as a specific number | |||
// of pixels per inch. Displays and printers differ but 96 pixels per | |||
// inch is an acceptable standard to beging with. | |||
public static final int PIXELS_PER_INCH = 96; // MB | |||
// Cnstants that defines how many pixels and points there are in a | |||
// millimetre. These values are required for the conversion algorithm. | |||
public static final double PIXELS_PER_MILLIMETRES = 3.78; // MB | |||
public static final double POINTS_PER_MILLIMETRE = 2.83; // MB | |||
// The column width returned by HSSF and the width of a picture when | |||
// positioned to exactly cover one cell are different by almost exactly | |||
// 2mm - give or take rounding errors. This constant allows that | |||
// additional amount to be accounted for when calculating how many | |||
// celles the image ought to overlie. | |||
public static final double CELL_BORDER_WIDTH_MILLIMETRES = 2.0D; // MB | |||
public static final short EXCEL_COLUMN_WIDTH_FACTOR = 256; | |||
public static final int UNIT_OFFSET_LENGTH = 7; | |||
public static final int[] UNIT_OFFSET_MAP = new int[] | |||
{ 0, 36, 73, 109, 146, 182, 219 }; | |||
/** | |||
* pixel units to excel width units(units of 1/256th of a character width) | |||
* @param pxs | |||
* @return | |||
*/ | |||
public static short pixel2WidthUnits(int pxs) { | |||
short widthUnits = (short) (EXCEL_COLUMN_WIDTH_FACTOR * | |||
(pxs / UNIT_OFFSET_LENGTH)); | |||
widthUnits += UNIT_OFFSET_MAP[(pxs % UNIT_OFFSET_LENGTH)]; | |||
return widthUnits; | |||
} | |||
/** | |||
* excel width units(units of 1/256th of a character width) to pixel | |||
* units. | |||
* | |||
* @param widthUnits | |||
* @return | |||
*/ | |||
public static int widthUnits2Pixel(short widthUnits) { | |||
int pixels = (widthUnits / EXCEL_COLUMN_WIDTH_FACTOR) | |||
* UNIT_OFFSET_LENGTH; | |||
int offsetWidthUnits = widthUnits % EXCEL_COLUMN_WIDTH_FACTOR; | |||
pixels += Math.round(offsetWidthUnits / | |||
((float) EXCEL_COLUMN_WIDTH_FACTOR / UNIT_OFFSET_LENGTH)); | |||
return pixels; | |||
} | |||
/** | |||
* Convert Excel's width units into millimetres. | |||
* | |||
* @param widthUnits The width of the column or the height of the | |||
* row in Excel's units. | |||
* @return A primitive double that contains the columns width or rows | |||
* height in millimetres. | |||
*/ | |||
public static double widthUnits2Millimetres(short widthUnits) { | |||
return(ConvertImageUnits.widthUnits2Pixel(widthUnits) / | |||
ConvertImageUnits.PIXELS_PER_MILLIMETRES); | |||
} | |||
/** | |||
* Convert into millimetres Excel's width units.. | |||
* | |||
* @param millimetres A primitive double that contains the columns | |||
* width or rows height in millimetres. | |||
* @return A primitive int that contains the columns width or rows | |||
* height in Excel's units. | |||
*/ | |||
public static int millimetres2WidthUnits(double millimetres) { | |||
return(ConvertImageUnits.pixel2WidthUnits((int)(millimetres * | |||
ConvertImageUnits.PIXELS_PER_MILLIMETRES))); | |||
} | |||
} | |||
} |
@@ -1,73 +0,0 @@ | |||
/* ==================================================================== | |||
Licensed to the Apache Software Foundation (ASF) under one or more | |||
contributor license agreements. See the NOTICE file distributed with | |||
this work for additional information regarding copyright ownership. | |||
The ASF licenses this file to You under the Apache License, Version 2.0 | |||
(the "License"); you may not use this file except in compliance with | |||
the License. You may obtain a copy of the License at | |||
http://www.apache.org/licenses/LICENSE-2.0 | |||
Unless required by applicable law or agreed to in writing, software | |||
distributed under the License is distributed on an "AS IS" BASIS, | |||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | |||
See the License for the specific language governing permissions and | |||
limitations under the License. | |||
==================================================================== */ | |||
package org.apache.poi.hssf.usermodel.examples; | |||
import java.io.FileOutputStream; | |||
import java.io.IOException; | |||
import org.apache.poi.hssf.usermodel.HSSFCell; | |||
import org.apache.poi.hssf.usermodel.HSSFCellStyle; | |||
import org.apache.poi.hssf.usermodel.HSSFRow; | |||
import org.apache.poi.hssf.usermodel.HSSFSheet; | |||
import org.apache.poi.hssf.usermodel.HSSFWorkbook; | |||
import org.apache.poi.ss.usermodel.HorizontalAlignment; | |||
/** | |||
* Shows how various alignment options work. | |||
* | |||
* @author Glen Stampoultzis (glens at apache.org) | |||
*/ | |||
public class Alignment { | |||
public static void main(String[] args) throws IOException { | |||
HSSFWorkbook wb = new HSSFWorkbook(); | |||
HSSFSheet sheet = wb.createSheet("new sheet"); | |||
HSSFRow row = sheet.createRow(2); | |||
createCell(wb, row, 0, HorizontalAlignment.CENTER); | |||
createCell(wb, row, 1, HorizontalAlignment.CENTER_SELECTION); | |||
createCell(wb, row, 2, HorizontalAlignment.FILL); | |||
createCell(wb, row, 3, HorizontalAlignment.GENERAL); | |||
createCell(wb, row, 4, HorizontalAlignment.JUSTIFY); | |||
createCell(wb, row, 5, HorizontalAlignment.LEFT); | |||
createCell(wb, row, 6, HorizontalAlignment.RIGHT); | |||
// Write the output to a file | |||
FileOutputStream fileOut = new FileOutputStream("workbook.xls"); | |||
wb.write(fileOut); | |||
fileOut.close(); | |||
wb.close(); | |||
} | |||
/** | |||
* Creates a cell and aligns it a certain way. | |||
* | |||
* @param wb the workbook | |||
* @param row the row to create the cell in | |||
* @param column the column number to create the cell in | |||
* @param align the alignment for the cell. | |||
*/ | |||
private static void createCell(HSSFWorkbook wb, HSSFRow row, int column, HorizontalAlignment align) { | |||
HSSFCell cell = row.createCell(column); | |||
cell.setCellValue("Align It"); | |||
HSSFCellStyle cellStyle = wb.createCellStyle(); | |||
cellStyle.setAlignment(align); | |||
cell.setCellStyle(cellStyle); | |||
} | |||
} |
@@ -1,172 +0,0 @@ | |||
/* ==================================================================== | |||
Licensed to the Apache Software Foundation (ASF) under one or more | |||
contributor license agreements. See the NOTICE file distributed with | |||
this work for additional information regarding copyright ownership. | |||
The ASF licenses this file to You under the Apache License, Version 2.0 | |||
(the "License"); you may not use this file except in compliance with | |||
the License. You may obtain a copy of the License at | |||
http://www.apache.org/licenses/LICENSE-2.0 | |||
Unless required by applicable law or agreed to in writing, software | |||
distributed under the License is distributed on an "AS IS" BASIS, | |||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | |||
See the License for the specific language governing permissions and | |||
limitations under the License. | |||
==================================================================== */ | |||
package org.apache.poi.hssf.usermodel.examples; | |||
import org.apache.poi.hssf.usermodel.*; | |||
import org.apache.poi.hssf.util.HSSFColor; | |||
import org.apache.poi.ss.usermodel.CellStyle; | |||
import org.apache.poi.ss.usermodel.Font; | |||
import java.io.FileOutputStream; | |||
import java.io.IOException; | |||
/** | |||
* Demonstrates many features of the user API at once. Used in the HOW-TO guide. | |||
* | |||
* @author Glen Stampoultzis (glens at apache.org) | |||
* @author Andrew Oliver (acoliver at apache.org) | |||
*/ | |||
public class BigExample { | |||
public static void main(String[] args) throws IOException { | |||
int rownum; | |||
// create a new file | |||
FileOutputStream out = new FileOutputStream("workbook.xls"); | |||
// create a new workbook | |||
HSSFWorkbook wb = new HSSFWorkbook(); | |||
// create a new sheet | |||
HSSFSheet s = wb.createSheet(); | |||
// declare a row object reference | |||
HSSFRow r = null; | |||
// declare a cell object reference | |||
HSSFCell c = null; | |||
// create 3 cell styles | |||
HSSFCellStyle cs = wb.createCellStyle(); | |||
HSSFCellStyle cs2 = wb.createCellStyle(); | |||
HSSFCellStyle cs3 = wb.createCellStyle(); | |||
// create 2 fonts objects | |||
HSSFFont f = wb.createFont(); | |||
HSSFFont f2 = wb.createFont(); | |||
//set font 1 to 12 point type | |||
f.setFontHeightInPoints((short) 12); | |||
//make it red | |||
f.setColor(HSSFColor.RED.index); | |||
// make it bold | |||
//arial is the default font | |||
f.setBoldweight(Font.BOLDWEIGHT_BOLD); | |||
//set font 2 to 10 point type | |||
f2.setFontHeightInPoints((short) 10); | |||
//make it the color at palette index 0xf (white) | |||
f2.setColor(HSSFColor.WHITE.index); | |||
//make it bold | |||
f2.setBoldweight(Font.BOLDWEIGHT_BOLD); | |||
//set cell stlye | |||
cs.setFont(f); | |||
//set the cell format see HSSFDataFromat for a full list | |||
cs.setDataFormat(HSSFDataFormat.getBuiltinFormat("($#,##0_);[Red]($#,##0)")); | |||
//set a thin border | |||
cs2.setBorderBottom(CellStyle.BORDER_THIN); | |||
//fill w fg fill color | |||
cs2.setFillPattern(HSSFCellStyle.SOLID_FOREGROUND); | |||
// set foreground fill to red | |||
cs2.setFillForegroundColor(HSSFColor.RED.index); | |||
// set the font | |||
cs2.setFont(f2); | |||
// set the sheet name to HSSF Test | |||
wb.setSheetName(0, "HSSF Test"); | |||
// create a sheet with 300 rows (0-299) | |||
for (rownum = 0; rownum < 300; rownum++) | |||
{ | |||
// create a row | |||
r = s.createRow(rownum); | |||
// on every other row | |||
if ((rownum % 2) == 0) | |||
{ | |||
// make the row height bigger (in twips - 1/20 of a point) | |||
r.setHeight((short) 0x249); | |||
} | |||
//r.setRowNum(( short ) rownum); | |||
// create 50 cells (0-49) (the += 2 becomes apparent later | |||
for (int cellnum = 0; cellnum < 50; cellnum += 2) | |||
{ | |||
// create a numeric cell | |||
c = r.createCell(cellnum); | |||
// do some goofy math to demonstrate decimals | |||
c.setCellValue(rownum * 10000 + cellnum | |||
+ (((double) rownum / 1000) | |||
+ ((double) cellnum / 10000))); | |||
// on every other row | |||
if ((rownum % 2) == 0) | |||
{ | |||
// set this cell to the first cell style we defined | |||
c.setCellStyle(cs); | |||
} | |||
// create a string cell (see why += 2 in the | |||
c = r.createCell(cellnum + 1); | |||
// set the cell's string value to "TEST" | |||
c.setCellValue("TEST"); | |||
// make this column a bit wider | |||
s.setColumnWidth(cellnum + 1, (int)((50 * 8) / ((double) 1 / 20))); | |||
// on every other row | |||
if ((rownum % 2) == 0) | |||
{ | |||
// set this to the white on red cell style | |||
// we defined above | |||
c.setCellStyle(cs2); | |||
} | |||
} | |||
} | |||
//draw a thick black border on the row at the bottom using BLANKS | |||
// advance 2 rows | |||
rownum++; | |||
rownum++; | |||
r = s.createRow(rownum); | |||
// define the third style to be the default | |||
// except with a thick black border at the bottom | |||
cs3.setBorderBottom(CellStyle.BORDER_THICK); | |||
//create 50 cells | |||
for (int cellnum =0; cellnum < 50; cellnum++) { | |||
//create a blank type cell (no value) | |||
c = r.createCell(cellnum); | |||
// set it to the thick black border style | |||
c.setCellStyle(cs3); | |||
} | |||
//end draw thick black border | |||
// demonstrate adding/naming and deleting a sheet | |||
// create a sheet, set its title then delete it | |||
wb.createSheet(); | |||
wb.setSheetName(1, "DeletedSheet"); | |||
wb.removeSheetAt(1); | |||
//end deleted sheet | |||
// write the workbook to the output stream | |||
// close our file (don't blow out our file handles | |||
wb.write(out); | |||
out.close(); | |||
wb.close(); | |||
} | |||
} |
@@ -1,60 +0,0 @@ | |||
/* ==================================================================== | |||
Licensed to the Apache Software Foundation (ASF) under one or more | |||
contributor license agreements. See the NOTICE file distributed with | |||
this work for additional information regarding copyright ownership. | |||
The ASF licenses this file to You under the Apache License, Version 2.0 | |||
(the "License"); you may not use this file except in compliance with | |||
the License. You may obtain a copy of the License at | |||
http://www.apache.org/licenses/LICENSE-2.0 | |||
Unless required by applicable law or agreed to in writing, software | |||
distributed under the License is distributed on an "AS IS" BASIS, | |||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | |||
See the License for the specific language governing permissions and | |||
limitations under the License. | |||
==================================================================== */ | |||
package org.apache.poi.hssf.usermodel.examples; | |||
import org.apache.poi.hssf.usermodel.*; | |||
import org.apache.poi.hssf.util.HSSFColor; | |||
import java.io.FileOutputStream; | |||
import java.io.IOException; | |||
/** | |||
* Demonstrates how to create borders around cells. | |||
* | |||
* @author Glen Stampoultzis (glens at apache.org) | |||
*/ | |||
public class Borders { | |||
public static void main(String[] args) throws IOException { | |||
HSSFWorkbook wb = new HSSFWorkbook(); | |||
HSSFSheet sheet = wb.createSheet("new sheet"); | |||
// Create a row and put some cells in it. Rows are 0 based. | |||
HSSFRow row = sheet.createRow(1); | |||
// Create a cell and put a value in it. | |||
HSSFCell cell = row.createCell(1); | |||
cell.setCellValue(4); | |||
// Style the cell with borders all around. | |||
HSSFCellStyle style = wb.createCellStyle(); | |||
style.setBorderBottom(HSSFCellStyle.BORDER_THIN); | |||
style.setBottomBorderColor(HSSFColor.BLACK.index); | |||
style.setBorderLeft(HSSFCellStyle.BORDER_THIN); | |||
style.setLeftBorderColor(HSSFColor.GREEN.index); | |||
style.setBorderRight(HSSFCellStyle.BORDER_THIN); | |||
style.setRightBorderColor(HSSFColor.BLUE.index); | |||
style.setBorderTop(HSSFCellStyle.BORDER_MEDIUM_DASHED); | |||
style.setTopBorderColor(HSSFColor.ORANGE.index); | |||
cell.setCellStyle(style); | |||
// Write the output to a file | |||
FileOutputStream fileOut = new FileOutputStream("workbook.xls"); | |||
wb.write(fileOut); | |||
fileOut.close(); | |||
} | |||
} |
@@ -1,98 +0,0 @@ | |||
/* ==================================================================== | |||
Licensed to the Apache Software Foundation (ASF) under one or more | |||
contributor license agreements. See the NOTICE file distributed with | |||
this work for additional information regarding copyright ownership. | |||
The ASF licenses this file to You under the Apache License, Version 2.0 | |||
(the "License"); you may not use this file except in compliance with | |||
the License. You may obtain a copy of the License at | |||
http://www.apache.org/licenses/LICENSE-2.0 | |||
Unless required by applicable law or agreed to in writing, software | |||
distributed under the License is distributed on an "AS IS" BASIS, | |||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | |||
See the License for the specific language governing permissions and | |||
limitations under the License. | |||
==================================================================== */ | |||
package org.apache.poi.hssf.usermodel.examples; | |||
import org.apache.poi.hssf.usermodel.*; | |||
import org.apache.poi.hssf.util.HSSFColor; | |||
import java.io.*; | |||
/** | |||
* Demonstrates how to work with excel cell comments. | |||
* | |||
* <p> | |||
* Excel comment is a kind of a text shape, | |||
* so inserting a comment is very similar to placing a text box in a worksheet | |||
* </p> | |||
* | |||
* @author Yegor Kozlov | |||
*/ | |||
public class CellComments { | |||
public static void main(String[] args) throws IOException { | |||
HSSFWorkbook wb = new HSSFWorkbook(); | |||
HSSFSheet sheet = wb.createSheet("Cell comments in POI HSSF"); | |||
// Create the drawing patriarch. This is the top level container for all shapes including cell comments. | |||
HSSFPatriarch patr = sheet.createDrawingPatriarch(); | |||
//create a cell in row 3 | |||
HSSFCell cell1 = sheet.createRow(3).createCell(1); | |||
cell1.setCellValue(new HSSFRichTextString("Hello, World")); | |||
//anchor defines size and position of the comment in worksheet | |||
HSSFComment comment1 = patr.createComment(new HSSFClientAnchor(0, 0, 0, 0, (short)4, 2, (short) 6, 5)); | |||
// set text in the comment | |||
comment1.setString(new HSSFRichTextString("We can set comments in POI")); | |||
//set comment author. | |||
//you can see it in the status bar when moving mouse over the commented cell | |||
comment1.setAuthor("Apache Software Foundation"); | |||
// The first way to assign comment to a cell is via HSSFCell.setCellComment method | |||
cell1.setCellComment(comment1); | |||
//create another cell in row 6 | |||
HSSFCell cell2 = sheet.createRow(6).createCell(1); | |||
cell2.setCellValue(36.6); | |||
HSSFComment comment2 = patr.createComment(new HSSFClientAnchor(0, 0, 0, 0, (short)4, 8, (short) 6, 11)); | |||
//modify background color of the comment | |||
comment2.setFillColor(204, 236, 255); | |||
HSSFRichTextString string = new HSSFRichTextString("Normal body temperature"); | |||
//apply custom font to the text in the comment | |||
HSSFFont font = wb.createFont(); | |||
font.setFontName("Arial"); | |||
font.setFontHeightInPoints((short)10); | |||
font.setBoldweight(HSSFFont.BOLDWEIGHT_BOLD); | |||
font.setColor(HSSFColor.RED.index); | |||
string.applyFont(font); | |||
comment2.setString(string); | |||
comment2.setVisible(true); //by default comments are hidden. This one is always visible. | |||
comment2.setAuthor("Bill Gates"); | |||
/** | |||
* The second way to assign comment to a cell is to implicitly specify its row and column. | |||
* Note, it is possible to set row and column of a non-existing cell. | |||
* It works, the comment is visible. | |||
*/ | |||
comment2.setRow(6); | |||
comment2.setColumn(1); | |||
FileOutputStream out = new FileOutputStream("poi_comment.xls"); | |||
wb.write(out); | |||
out.close(); | |||
} | |||
} |
@@ -1,45 +0,0 @@ | |||
/* ==================================================================== | |||
Licensed to the Apache Software Foundation (ASF) under one or more | |||
contributor license agreements. See the NOTICE file distributed with | |||
this work for additional information regarding copyright ownership. | |||
The ASF licenses this file to You under the Apache License, Version 2.0 | |||
(the "License"); you may not use this file except in compliance with | |||
the License. You may obtain a copy of the License at | |||
http://www.apache.org/licenses/LICENSE-2.0 | |||
Unless required by applicable law or agreed to in writing, software | |||
distributed under the License is distributed on an "AS IS" BASIS, | |||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | |||
See the License for the specific language governing permissions and | |||
limitations under the License. | |||
==================================================================== */ | |||
package org.apache.poi.hssf.usermodel.examples; | |||
import java.io.FileOutputStream; | |||
import java.io.IOException; | |||
import java.util.Date; | |||
import org.apache.poi.hssf.usermodel.HSSFRow; | |||
import org.apache.poi.hssf.usermodel.HSSFSheet; | |||
import org.apache.poi.hssf.usermodel.HSSFWorkbook; | |||
import org.apache.poi.ss.usermodel.CellType; | |||
public class CellTypes { | |||
public static void main(String[] args) throws IOException { | |||
HSSFWorkbook wb = new HSSFWorkbook(); | |||
HSSFSheet sheet = wb.createSheet("new sheet"); | |||
HSSFRow row = sheet.createRow(2); | |||
row.createCell(0).setCellValue(1.1); | |||
row.createCell(1).setCellValue(new Date()); | |||
row.createCell(2).setCellValue("a string"); | |||
row.createCell(3).setCellValue(true); | |||
row.createCell(4).setCellType(CellType.ERROR); | |||
// Write the output to a file | |||
FileOutputStream fileOut = new FileOutputStream("workbook.xls"); | |||
wb.write(fileOut); | |||
fileOut.close(); | |||
} | |||
} |
@@ -1,56 +0,0 @@ | |||
/* ==================================================================== | |||
Licensed to the Apache Software Foundation (ASF) under one or more | |||
contributor license agreements. See the NOTICE file distributed with | |||
this work for additional information regarding copyright ownership. | |||
The ASF licenses this file to You under the Apache License, Version 2.0 | |||
(the "License"); you may not use this file except in compliance with | |||
the License. You may obtain a copy of the License at | |||
http://www.apache.org/licenses/LICENSE-2.0 | |||
Unless required by applicable law or agreed to in writing, software | |||
distributed under the License is distributed on an "AS IS" BASIS, | |||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | |||
See the License for the specific language governing permissions and | |||
limitations under the License. | |||
==================================================================== */ | |||
package org.apache.poi.hssf.usermodel.examples; | |||
import org.apache.poi.hssf.usermodel.HSSFWorkbook; | |||
import org.apache.poi.hssf.usermodel.HSSFSheet; | |||
import org.apache.poi.hssf.usermodel.HSSFRow; | |||
import org.apache.poi.hssf.usermodel.HSSFCell; | |||
import java.io.FileOutputStream; | |||
import java.io.IOException; | |||
/** | |||
* Illustrates how to create cell values. | |||
* | |||
* @author Glen Stampoultzis (glens at apache.org) | |||
*/ | |||
public class CreateCells { | |||
public static void main(String[] args) throws IOException { | |||
HSSFWorkbook wb = new HSSFWorkbook(); | |||
HSSFSheet sheet = wb.createSheet("new sheet"); | |||
// Create a row and put some cells in it. Rows are 0 based. | |||
HSSFRow row = sheet.createRow(0); | |||
// Create a cell and put a value in it. | |||
HSSFCell cell = row.createCell(0); | |||
cell.setCellValue(1); | |||
// Or do it on one line. | |||
row.createCell(1).setCellValue(1.2); | |||
row.createCell(2).setCellValue("This is a string"); | |||
row.createCell(3).setCellValue(true); | |||
// Write the output to a file | |||
FileOutputStream fileOut = new FileOutputStream("workbook.xls"); | |||
wb.write(fileOut); | |||
fileOut.close(); | |||
wb.close(); | |||
} | |||
} |
@@ -1,58 +0,0 @@ | |||
/* ==================================================================== | |||
Licensed to the Apache Software Foundation (ASF) under one or more | |||
contributor license agreements. See the NOTICE file distributed with | |||
this work for additional information regarding copyright ownership. | |||
The ASF licenses this file to You under the Apache License, Version 2.0 | |||
(the "License"); you may not use this file except in compliance with | |||
the License. You may obtain a copy of the License at | |||
http://www.apache.org/licenses/LICENSE-2.0 | |||
Unless required by applicable law or agreed to in writing, software | |||
distributed under the License is distributed on an "AS IS" BASIS, | |||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | |||
See the License for the specific language governing permissions and | |||
limitations under the License. | |||
==================================================================== */ | |||
package org.apache.poi.hssf.usermodel.examples; | |||
import org.apache.poi.hssf.usermodel.*; | |||
import java.io.FileOutputStream; | |||
import java.io.IOException; | |||
import java.util.Date; | |||
/** | |||
* An example on how to cells with dates. The important thing to note | |||
* about dates is that they are really normal numeric cells that are | |||
* formatted specially. | |||
* | |||
* @author Glen Stampoultzis (glens at apache.org) | |||
*/ | |||
public class CreateDateCells { | |||
public static void main(String[] args) throws IOException { | |||
HSSFWorkbook wb = new HSSFWorkbook(); | |||
HSSFSheet sheet = wb.createSheet("new sheet"); | |||
// Create a row and put some cells in it. Rows are 0 based. | |||
HSSFRow row = sheet.createRow(0); | |||
// Create a cell and put a date value in it. The first cell is not styled as a date. | |||
HSSFCell cell = row.createCell(0); | |||
cell.setCellValue(new Date()); | |||
// we style the second cell as a date (and time). It is important to create a new cell style from the workbook | |||
// otherwise you can end up modifying the built in style and effecting not only this cell but other cells. | |||
HSSFCellStyle cellStyle = wb.createCellStyle(); | |||
cellStyle.setDataFormat(HSSFDataFormat.getBuiltinFormat("m/d/yy h:mm")); | |||
cell = row.createCell(1); | |||
cell.setCellValue(new Date()); | |||
cell.setCellStyle(cellStyle); | |||
// Write the output to a file | |||
FileOutputStream fileOut = new FileOutputStream("workbook.xls"); | |||
wb.write(fileOut); | |||
fileOut.close(); | |||
} | |||
} |
@@ -1,72 +0,0 @@ | |||
/* ==================================================================== | |||
Licensed to the Apache Software Foundation (ASF) under one or more | |||
contributor license agreements. See the NOTICE file distributed with | |||
this work for additional information regarding copyright ownership. | |||
The ASF licenses this file to You under the Apache License, Version 2.0 | |||
(the "License"); you may not use this file except in compliance with | |||
the License. You may obtain a copy of the License at | |||
http://www.apache.org/licenses/LICENSE-2.0 | |||
Unless required by applicable law or agreed to in writing, software | |||
distributed under the License is distributed on an "AS IS" BASIS, | |||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | |||
See the License for the specific language governing permissions and | |||
limitations under the License. | |||
==================================================================== */ | |||
package org.apache.poi.hssf.usermodel.examples; | |||
import java.io.FileInputStream; | |||
import java.util.Iterator; | |||
import org.apache.poi.hslf.usermodel.HSLFSlideShow; | |||
import org.apache.poi.hslf.usermodel.HSLFSlideShowImpl; | |||
import org.apache.poi.hssf.usermodel.HSSFObjectData; | |||
import org.apache.poi.hssf.usermodel.HSSFWorkbook; | |||
import org.apache.poi.hwpf.HWPFDocument; | |||
import org.apache.poi.poifs.filesystem.DirectoryNode; | |||
import org.apache.poi.poifs.filesystem.Entry; | |||
import org.apache.poi.poifs.filesystem.POIFSFileSystem; | |||
/** | |||
* Demonstrates how you can extract embedded data from a .xls file | |||
*/ | |||
public class EmeddedObjects { | |||
@SuppressWarnings("unused") | |||
public static void main(String[] args) throws Exception { | |||
POIFSFileSystem fs = new POIFSFileSystem(new FileInputStream(args[0])); | |||
HSSFWorkbook workbook = new HSSFWorkbook(fs); | |||
for (HSSFObjectData obj : workbook.getAllEmbeddedObjects()) { | |||
//the OLE2 Class Name of the object | |||
String oleName = obj.getOLE2ClassName(); | |||
if (oleName.equals("Worksheet")) { | |||
DirectoryNode dn = (DirectoryNode) obj.getDirectory(); | |||
HSSFWorkbook embeddedWorkbook = new HSSFWorkbook(dn, fs, false); | |||
//System.out.println(entry.getName() + ": " + embeddedWorkbook.getNumberOfSheets()); | |||
embeddedWorkbook.close(); | |||
} else if (oleName.equals("Document")) { | |||
DirectoryNode dn = (DirectoryNode) obj.getDirectory(); | |||
HWPFDocument embeddedWordDocument = new HWPFDocument(dn); | |||
//System.out.println(entry.getName() + ": " + embeddedWordDocument.getRange().text()); | |||
} else if (oleName.equals("Presentation")) { | |||
DirectoryNode dn = (DirectoryNode) obj.getDirectory(); | |||
HSLFSlideShow embeddedPowerPointDocument = new HSLFSlideShow(new HSLFSlideShowImpl(dn)); | |||
//System.out.println(entry.getName() + ": " + embeddedPowerPointDocument.getSlides().length); | |||
} else { | |||
if(obj.hasDirectoryEntry()){ | |||
// The DirectoryEntry is a DocumentNode. Examine its entries to find out what it is | |||
DirectoryNode dn = (DirectoryNode) obj.getDirectory(); | |||
for (Iterator<Entry> entries = dn.getEntries(); entries.hasNext();) { | |||
Entry entry = entries.next(); | |||
//System.out.println(oleName + "." + entry.getName()); | |||
} | |||
} else { | |||
// There is no DirectoryEntry | |||
// Recover the object's data from the HSSFObjectData instance. | |||
byte[] objectData = obj.getObjectData(); | |||
} | |||
} | |||
} | |||
workbook.close(); | |||
} | |||
} |
@@ -1,119 +0,0 @@ | |||
/* ==================================================================== | |||
Licensed to the Apache Software Foundation (ASF) under one or more | |||
contributor license agreements. See the NOTICE file distributed with | |||
this work for additional information regarding copyright ownership. | |||
The ASF licenses this file to You under the Apache License, Version 2.0 | |||
(the "License"); you may not use this file except in compliance with | |||
the License. You may obtain a copy of the License at | |||
http://www.apache.org/licenses/LICENSE-2.0 | |||
Unless required by applicable law or agreed to in writing, software | |||
distributed under the License is distributed on an "AS IS" BASIS, | |||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | |||
See the License for the specific language governing permissions and | |||
limitations under the License. | |||
==================================================================== */ | |||
package org.apache.poi.hssf.usermodel.examples; | |||
import org.apache.poi.hssf.eventusermodel.HSSFEventFactory; | |||
import org.apache.poi.hssf.eventusermodel.HSSFListener; | |||
import org.apache.poi.hssf.eventusermodel.HSSFRequest; | |||
import org.apache.poi.hssf.record.*; | |||
import org.apache.poi.poifs.filesystem.POIFSFileSystem; | |||
import java.io.FileInputStream; | |||
import java.io.IOException; | |||
import java.io.InputStream; | |||
/** | |||
* This example shows how to use the event API for reading a file. | |||
*/ | |||
public class EventExample | |||
implements HSSFListener | |||
{ | |||
private SSTRecord sstrec; | |||
/** | |||
* This method listens for incoming records and handles them as required. | |||
* @param record The record that was found while reading. | |||
*/ | |||
@Override | |||
public void processRecord(Record record) | |||
{ | |||
switch (record.getSid()) | |||
{ | |||
// the BOFRecord can represent either the beginning of a sheet or the workbook | |||
case BOFRecord.sid: | |||
BOFRecord bof = (BOFRecord) record; | |||
if (bof.getType() == BOFRecord.TYPE_WORKBOOK) | |||
{ | |||
System.out.println("Encountered workbook"); | |||
// assigned to the class level member | |||
} else if (bof.getType() == BOFRecord.TYPE_WORKSHEET) | |||
{ | |||
System.out.println("Encountered sheet reference"); | |||
} | |||
break; | |||
case BoundSheetRecord.sid: | |||
BoundSheetRecord bsr = (BoundSheetRecord) record; | |||
System.out.println("New sheet named: " + bsr.getSheetname()); | |||
break; | |||
case RowRecord.sid: | |||
RowRecord rowrec = (RowRecord) record; | |||
System.out.println("Row found, first column at " | |||
+ rowrec.getFirstCol() + " last column at " + rowrec.getLastCol()); | |||
break; | |||
case NumberRecord.sid: | |||
NumberRecord numrec = (NumberRecord) record; | |||
System.out.println("Cell found with value " + numrec.getValue() | |||
+ " at row " + numrec.getRow() + " and column " + numrec.getColumn()); | |||
break; | |||
// SSTRecords store a array of unique strings used in Excel. | |||
case SSTRecord.sid: | |||
sstrec = (SSTRecord) record; | |||
for (int k = 0; k < sstrec.getNumUniqueStrings(); k++) | |||
{ | |||
System.out.println("String table value " + k + " = " + sstrec.getString(k)); | |||
} | |||
break; | |||
case LabelSSTRecord.sid: | |||
LabelSSTRecord lrec = (LabelSSTRecord) record; | |||
System.out.println("String cell found with value " | |||
+ sstrec.getString(lrec.getSSTIndex())); | |||
break; | |||
} | |||
} | |||
/** | |||
* Read an excel file and spit out what we find. | |||
* | |||
* @param args Expect one argument that is the file to read. | |||
* @throws IOException When there is an error processing the file. | |||
*/ | |||
public static void main(String[] args) throws IOException | |||
{ | |||
// create a new file input stream with the input file specified | |||
// at the command line | |||
FileInputStream fin = new FileInputStream(args[0]); | |||
// create a new org.apache.poi.poifs.filesystem.Filesystem | |||
POIFSFileSystem poifs = new POIFSFileSystem(fin); | |||
// get the Workbook (excel part) stream in a InputStream | |||
InputStream din = poifs.createDocumentInputStream("Workbook"); | |||
// construct out HSSFRequest object | |||
HSSFRequest req = new HSSFRequest(); | |||
// lazy listen for ALL records with the listener shown above | |||
req.addListenerForAllRecords(new EventExample()); | |||
// create our event factory | |||
HSSFEventFactory factory = new HSSFEventFactory(); | |||
// process our events based on the document input stream | |||
factory.processEvents(req, din); | |||
// once all the events are processed close our file input stream | |||
fin.close(); | |||
// and our document input stream (don't want to leak these!) | |||
din.close(); | |||
System.out.println("done."); | |||
} | |||
} |
@@ -1,60 +0,0 @@ | |||
/* ==================================================================== | |||
Licensed to the Apache Software Foundation (ASF) under one or more | |||
contributor license agreements. See the NOTICE file distributed with | |||
this work for additional information regarding copyright ownership. | |||
The ASF licenses this file to You under the Apache License, Version 2.0 | |||
(the "License"); you may not use this file except in compliance with | |||
the License. You may obtain a copy of the License at | |||
http://www.apache.org/licenses/LICENSE-2.0 | |||
Unless required by applicable law or agreed to in writing, software | |||
distributed under the License is distributed on an "AS IS" BASIS, | |||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | |||
See the License for the specific language governing permissions and | |||
limitations under the License. | |||
==================================================================== */ | |||
package org.apache.poi.hssf.usermodel.examples; | |||
import org.apache.poi.hssf.usermodel.*; | |||
import org.apache.poi.hssf.util.HSSFColor; | |||
import java.io.FileOutputStream; | |||
import java.io.IOException; | |||
/** | |||
* Shows how to use various fills. | |||
* | |||
* @author Glen Stampoultzis (glens at apache.org) | |||
*/ | |||
public class FrillsAndFills { | |||
public static void main(String[] args) throws IOException { | |||
HSSFWorkbook wb = new HSSFWorkbook(); | |||
HSSFSheet sheet = wb.createSheet("new sheet"); | |||
// Create a row and put some cells in it. Rows are 0 based. | |||
HSSFRow row = sheet.createRow(1); | |||
// Aqua background | |||
HSSFCellStyle style = wb.createCellStyle(); | |||
style.setFillBackgroundColor(HSSFColor.AQUA.index); | |||
style.setFillPattern(HSSFCellStyle.BIG_SPOTS); | |||
HSSFCell cell = row.createCell(1); | |||
cell.setCellValue("X"); | |||
cell.setCellStyle(style); | |||
// Orange "foreground", foreground being the fill foreground not the font color. | |||
style = wb.createCellStyle(); | |||
style.setFillForegroundColor(HSSFColor.ORANGE.index); | |||
style.setFillPattern(HSSFCellStyle.SOLID_FOREGROUND); | |||
cell = row.createCell(2); | |||
cell.setCellValue("X"); | |||
cell.setCellStyle(style); | |||
// Write the output to a file | |||
FileOutputStream fileOut = new FileOutputStream("workbook.xls"); | |||
wb.write(fileOut); | |||
fileOut.close(); | |||
} | |||
} |
@@ -1,256 +0,0 @@ | |||
/* ==================================================================== | |||
Licensed to the Apache Software Foundation (ASF) under one or more | |||
contributor license agreements. See the NOTICE file distributed with | |||
this work for additional information regarding copyright ownership. | |||
The ASF licenses this file to You under the Apache License, Version 2.0 | |||
(the "License"); you may not use this file except in compliance with | |||
the License. You may obtain a copy of the License at | |||
http://www.apache.org/licenses/LICENSE-2.0 | |||
Unless required by applicable law or agreed to in writing, software | |||
distributed under the License is distributed on an "AS IS" BASIS, | |||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | |||
See the License for the specific language governing permissions and | |||
limitations under the License. | |||
==================================================================== */ | |||
package org.apache.poi.hssf.usermodel.examples; | |||
import java.io.FileInputStream; | |||
import java.io.FileOutputStream; | |||
import java.io.IOException; | |||
import java.util.Locale; | |||
import org.apache.poi.hssf.usermodel.HSSFCell; | |||
import org.apache.poi.hssf.usermodel.HSSFCellStyle; | |||
import org.apache.poi.hssf.usermodel.HSSFDataFormat; | |||
import org.apache.poi.hssf.usermodel.HSSFFont; | |||
import org.apache.poi.hssf.usermodel.HSSFRichTextString; | |||
import org.apache.poi.hssf.usermodel.HSSFRow; | |||
import org.apache.poi.hssf.usermodel.HSSFSheet; | |||
import org.apache.poi.hssf.usermodel.HSSFWorkbook; | |||
import org.apache.poi.ss.usermodel.BorderStyle; | |||
import org.apache.poi.ss.util.CellRangeAddress; | |||
/** | |||
* File for HSSF testing/examples | |||
* | |||
* THIS IS NOT THE MAIN HSSF FILE!! This is a utility for testing functionality. | |||
* It does contain sample API usage that may be educational to regular API | |||
* users. | |||
*/ | |||
public final class HSSFReadWrite { | |||
/** | |||
* creates an {@link HSSFWorkbook} the specified OS filename. | |||
*/ | |||
private static HSSFWorkbook readFile(String filename) throws IOException { | |||
FileInputStream fis = new FileInputStream(filename); | |||
try { | |||
return new HSSFWorkbook(fis); | |||
} finally { | |||
fis.close(); | |||
} | |||
} | |||
/** | |||
* given a filename this outputs a sample sheet with just a set of | |||
* rows/cells. | |||
*/ | |||
private static void testCreateSampleSheet(String outputFilename) throws IOException { | |||
int rownum; | |||
HSSFWorkbook wb = new HSSFWorkbook(); | |||
HSSFSheet s = wb.createSheet(); | |||
HSSFCellStyle cs = wb.createCellStyle(); | |||
HSSFCellStyle cs2 = wb.createCellStyle(); | |||
HSSFCellStyle cs3 = wb.createCellStyle(); | |||
HSSFFont f = wb.createFont(); | |||
HSSFFont f2 = wb.createFont(); | |||
f.setFontHeightInPoints((short) 12); | |||
f.setColor((short) 0xA); | |||
f.setBold(true); | |||
f2.setFontHeightInPoints((short) 10); | |||
f2.setColor((short) 0xf); | |||
f2.setBold(true); | |||
cs.setFont(f); | |||
cs.setDataFormat(HSSFDataFormat.getBuiltinFormat("($#,##0_);[Red]($#,##0)")); | |||
cs2.setBorderBottom(BorderStyle.THIN); | |||
cs2.setFillPattern((short) 1); // fill w fg | |||
cs2.setFillForegroundColor((short) 0xA); | |||
cs2.setFont(f2); | |||
wb.setSheetName(0, "HSSF Test"); | |||
for (rownum = 0; rownum < 300; rownum++) { | |||
HSSFRow r = s.createRow(rownum); | |||
if ((rownum % 2) == 0) { | |||
r.setHeight((short) 0x249); | |||
} | |||
for (int cellnum = 0; cellnum < 50; cellnum += 2) { | |||
HSSFCell c = r.createCell(cellnum); | |||
c.setCellValue(rownum * 10000 + cellnum | |||
+ (((double) rownum / 1000) + ((double) cellnum / 10000))); | |||
if ((rownum % 2) == 0) { | |||
c.setCellStyle(cs); | |||
} | |||
c = r.createCell(cellnum + 1); | |||
c.setCellValue(new HSSFRichTextString("TEST")); | |||
// 50 characters divided by 1/20th of a point | |||
s.setColumnWidth(cellnum + 1, (int) (50 * 8 / 0.05)); | |||
if ((rownum % 2) == 0) { | |||
c.setCellStyle(cs2); | |||
} | |||
} | |||
} | |||
// draw a thick black border on the row at the bottom using BLANKS | |||
rownum++; | |||
rownum++; | |||
HSSFRow r = s.createRow(rownum); | |||
cs3.setBorderBottom(BorderStyle.THICK); | |||
for (int cellnum = 0; cellnum < 50; cellnum++) { | |||
HSSFCell c = r.createCell(cellnum); | |||
c.setCellStyle(cs3); | |||
} | |||
s.addMergedRegion(new CellRangeAddress(0, 3, 0, 3)); | |||
s.addMergedRegion(new CellRangeAddress(100, 110, 100, 110)); | |||
// end draw thick black border | |||
// create a sheet, set its title then delete it | |||
wb.createSheet(); | |||
wb.setSheetName(1, "DeletedSheet"); | |||
wb.removeSheetAt(1); | |||
// end deleted sheet | |||
FileOutputStream out = new FileOutputStream(outputFilename); | |||
try { | |||
wb.write(out); | |||
} finally { | |||
out.close(); | |||
} | |||
wb.close(); | |||
} | |||
/** | |||
* Method main | |||
* | |||
* Given 1 argument takes that as the filename, inputs it and dumps the | |||
* cell values/types out to sys.out.<br/> | |||
* | |||
* given 2 arguments where the second argument is the word "write" and the | |||
* first is the filename - writes out a sample (test) spreadsheet | |||
* see {@link HSSFReadWrite#testCreateSampleSheet(String)}.<br/> | |||
* | |||
* given 2 arguments where the first is an input filename and the second | |||
* an output filename (not write), attempts to fully read in the | |||
* spreadsheet and fully write it out.<br/> | |||
* | |||
* given 3 arguments where the first is an input filename and the second an | |||
* output filename (not write) and the third is "modify1", attempts to read in the | |||
* spreadsheet, deletes rows 0-24, 74-99. Changes cell at row 39, col 3 to | |||
* "MODIFIED CELL" then writes it out. Hence this is "modify test 1". If you | |||
* take the output from the write test, you'll have a valid scenario. | |||
*/ | |||
public static void main(String[] args) { | |||
if (args.length < 1) { | |||
System.err.println("At least one argument expected"); | |||
return; | |||
} | |||
String fileName = args[0]; | |||
try { | |||
if (args.length < 2) { | |||
HSSFWorkbook wb = HSSFReadWrite.readFile(fileName); | |||
System.out.println("Data dump:\n"); | |||
for (int k = 0; k < wb.getNumberOfSheets(); k++) { | |||
HSSFSheet sheet = wb.getSheetAt(k); | |||
int rows = sheet.getPhysicalNumberOfRows(); | |||
System.out.println("Sheet " + k + " \"" + wb.getSheetName(k) + "\" has " + rows | |||
+ " row(s)."); | |||
for (int r = 0; r < rows; r++) { | |||
HSSFRow row = sheet.getRow(r); | |||
if (row == null) { | |||
continue; | |||
} | |||
int cells = row.getPhysicalNumberOfCells(); | |||
System.out.println("\nROW " + row.getRowNum() + " has " + cells | |||
+ " cell(s)."); | |||
for (int c = 0; c < cells; c++) { | |||
HSSFCell cell = row.getCell(c); | |||
String value = null; | |||
switch (cell.getCellTypeEnum()) { | |||
case FORMULA: | |||
value = "FORMULA value=" + cell.getCellFormula(); | |||
break; | |||
case NUMERIC: | |||
value = "NUMERIC value=" + cell.getNumericCellValue(); | |||
break; | |||
case STRING: | |||
value = "STRING value=" + cell.getStringCellValue(); | |||
break; | |||
default: | |||
} | |||
System.out.println("CELL col=" + cell.getColumnIndex() + " VALUE=" | |||
+ value); | |||
} | |||
} | |||
} | |||
wb.close(); | |||
} else if (args.length == 2) { | |||
if (args[1].toLowerCase(Locale.ROOT).equals("write")) { | |||
System.out.println("Write mode"); | |||
long time = System.currentTimeMillis(); | |||
HSSFReadWrite.testCreateSampleSheet(fileName); | |||
System.out.println("" + (System.currentTimeMillis() - time) | |||
+ " ms generation time"); | |||
} else { | |||
System.out.println("readwrite test"); | |||
HSSFWorkbook wb = HSSFReadWrite.readFile(fileName); | |||
FileOutputStream stream = new FileOutputStream(args[1]); | |||
wb.write(stream); | |||
stream.close(); | |||
wb.close(); | |||
} | |||
} else if (args.length == 3 && args[2].toLowerCase(Locale.ROOT).equals("modify1")) { | |||
// delete row 0-24, row 74 - 99 && change cell 3 on row 39 to string "MODIFIED CELL!!" | |||
HSSFWorkbook wb = HSSFReadWrite.readFile(fileName); | |||
FileOutputStream stream = new FileOutputStream(args[1]); | |||
HSSFSheet sheet = wb.getSheetAt(0); | |||
for (int k = 0; k < 25; k++) { | |||
HSSFRow row = sheet.getRow(k); | |||
sheet.removeRow(row); | |||
} | |||
for (int k = 74; k < 100; k++) { | |||
HSSFRow row = sheet.getRow(k); | |||
sheet.removeRow(row); | |||
} | |||
HSSFRow row = sheet.getRow(39); | |||
HSSFCell cell = row.getCell(3); | |||
cell.setCellValue("MODIFIED CELL!!!!!"); | |||
wb.write(stream); | |||
stream.close(); | |||
wb.close(); | |||
} | |||
} catch (Exception e) { | |||
e.printStackTrace(); | |||
} | |||
} | |||
} |
@@ -1,48 +0,0 @@ | |||
/* ==================================================================== | |||
Licensed to the Apache Software Foundation (ASF) under one or more | |||
contributor license agreements. See the NOTICE file distributed with | |||
this work for additional information regarding copyright ownership. | |||
The ASF licenses this file to You under the Apache License, Version 2.0 | |||
(the "License"); you may not use this file except in compliance with | |||
the License. You may obtain a copy of the License at | |||
http://www.apache.org/licenses/LICENSE-2.0 | |||
Unless required by applicable law or agreed to in writing, software | |||
distributed under the License is distributed on an "AS IS" BASIS, | |||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | |||
See the License for the specific language governing permissions and | |||
limitations under the License. | |||
==================================================================== */ | |||
package org.apache.poi.hssf.usermodel.examples; | |||
import java.io.FileOutputStream; | |||
import java.io.IOException; | |||
import org.apache.poi.hssf.usermodel.HSSFCell; | |||
import org.apache.poi.hssf.usermodel.HSSFRow; | |||
import org.apache.poi.hssf.usermodel.HSSFSheet; | |||
import org.apache.poi.hssf.usermodel.HSSFWorkbook; | |||
import org.apache.poi.ss.usermodel.CellType; | |||
/** | |||
* Test if hyperlink formula, with url that got more than 127 characters, works | |||
* | |||
* @author Bernard Chesnoy | |||
*/ | |||
public class HyperlinkFormula { | |||
public static void main(String[] args) throws IOException { | |||
HSSFWorkbook wb = new HSSFWorkbook(); | |||
HSSFSheet sheet = wb.createSheet("new sheet"); | |||
HSSFRow row = sheet.createRow(0); | |||
HSSFCell cell = row.createCell(0); | |||
cell.setCellType(CellType.FORMULA); | |||
cell.setCellFormula("HYPERLINK(\"http://127.0.0.1:8080/toto/truc/index.html?test=aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\", \"test\")"); | |||
FileOutputStream fileOut = new FileOutputStream("workbook.xls"); | |||
wb.write(fileOut); | |||
fileOut.close(); | |||
} | |||
} |
@@ -1,97 +0,0 @@ | |||
/* ==================================================================== | |||
Licensed to the Apache Software Foundation (ASF) under one or more | |||
contributor license agreements. See the NOTICE file distributed with | |||
this work for additional information regarding copyright ownership. | |||
The ASF licenses this file to You under the Apache License, Version 2.0 | |||
(the "License"); you may not use this file except in compliance with | |||
the License. You may obtain a copy of the License at | |||
http://www.apache.org/licenses/LICENSE-2.0 | |||
Unless required by applicable law or agreed to in writing, software | |||
distributed under the License is distributed on an "AS IS" BASIS, | |||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | |||
See the License for the specific language governing permissions and | |||
limitations under the License. | |||
==================================================================== */ | |||
package org.apache.poi.hssf.usermodel.examples; | |||
import java.io.FileOutputStream; | |||
import java.io.IOException; | |||
import org.apache.poi.common.usermodel.HyperlinkType; | |||
import org.apache.poi.hssf.usermodel.HSSFCell; | |||
import org.apache.poi.hssf.usermodel.HSSFCellStyle; | |||
import org.apache.poi.hssf.usermodel.HSSFCreationHelper; | |||
import org.apache.poi.hssf.usermodel.HSSFFont; | |||
import org.apache.poi.hssf.usermodel.HSSFHyperlink; | |||
import org.apache.poi.hssf.usermodel.HSSFSheet; | |||
import org.apache.poi.hssf.usermodel.HSSFWorkbook; | |||
import org.apache.poi.hssf.util.HSSFColor; | |||
/** | |||
* Demonstrates how to create hyperlinks. | |||
* | |||
* @author Yegor Kozlov (yegor at apach.org) | |||
*/ | |||
public class Hyperlinks { | |||
public static void main(String[] args) throws IOException { | |||
HSSFWorkbook wb = new HSSFWorkbook(); | |||
HSSFCreationHelper helper = wb.getCreationHelper(); | |||
//cell style for hyperlinks | |||
//by default hyperlinks are blue and underlined | |||
HSSFCellStyle hlink_style = wb.createCellStyle(); | |||
HSSFFont hlink_font = wb.createFont(); | |||
hlink_font.setUnderline(HSSFFont.U_SINGLE); | |||
hlink_font.setColor(HSSFColor.BLUE.index); | |||
hlink_style.setFont(hlink_font); | |||
HSSFCell cell; | |||
HSSFSheet sheet = wb.createSheet("Hyperlinks"); | |||
//URL | |||
cell = sheet.createRow(0).createCell(0); | |||
cell.setCellValue("URL Link"); | |||
HSSFHyperlink link = helper.createHyperlink(HyperlinkType.URL); | |||
link.setAddress("http://poi.apache.org/"); | |||
cell.setHyperlink(link); | |||
cell.setCellStyle(hlink_style); | |||
//link to a file in the current directory | |||
cell = sheet.createRow(1).createCell(0); | |||
cell.setCellValue("File Link"); | |||
link = helper.createHyperlink(HyperlinkType.FILE); | |||
link.setAddress("link1.xls"); | |||
cell.setHyperlink(link); | |||
cell.setCellStyle(hlink_style); | |||
//e-mail link | |||
cell = sheet.createRow(2).createCell(0); | |||
cell.setCellValue("Email Link"); | |||
link = helper.createHyperlink(HyperlinkType.EMAIL); | |||
//note, if subject contains white spaces, make sure they are url-encoded | |||
link.setAddress("mailto:poi@apache.org?subject=Hyperlinks"); | |||
cell.setHyperlink(link); | |||
cell.setCellStyle(hlink_style); | |||
//link to a place in this workbook | |||
//create a target sheet and cell | |||
HSSFSheet sheet2 = wb.createSheet("Target Sheet"); | |||
sheet2.createRow(0).createCell(0).setCellValue("Target Cell"); | |||
cell = sheet.createRow(3).createCell(0); | |||
cell.setCellValue("Worksheet Link"); | |||
link = helper.createHyperlink(HyperlinkType.DOCUMENT); | |||
link.setAddress("'Target Sheet'!A1"); | |||
cell.setHyperlink(link); | |||
cell.setCellStyle(hlink_style); | |||
FileOutputStream out = new FileOutputStream("hssf-links.xls"); | |||
wb.write(out); | |||
out.close(); | |||
} | |||
} |
@@ -1,553 +0,0 @@ | |||
/* ==================================================================== | |||
Licensed to the Apache Software Foundation (ASF) under one or more | |||
contributor license agreements. See the NOTICE file distributed with | |||
this work for additional information regarding copyright ownership. | |||
The ASF licenses this file to You under the Apache License, Version 2.0 | |||
(the "License"); you may not use this file except in compliance with | |||
the License. You may obtain a copy of the License at | |||
http://www.apache.org/licenses/LICENSE-2.0 | |||
Unless required by applicable law or agreed to in writing, software | |||
distributed under the License is distributed on an "AS IS" BASIS, | |||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | |||
See the License for the specific language governing permissions and | |||
limitations under the License. | |||
==================================================================== */ | |||
package org.apache.poi.hssf.usermodel.examples; | |||
import java.io.File; | |||
import java.io.FileOutputStream; | |||
import java.io.FileNotFoundException; | |||
import java.io.IOException; | |||
import java.util.ArrayList; | |||
import org.apache.poi.hssf.usermodel.HSSFWorkbook; | |||
import org.apache.poi.hssf.usermodel.HSSFSheet; | |||
import org.apache.poi.hssf.usermodel.HSSFRow; | |||
import org.apache.poi.hssf.usermodel.HSSFCell; | |||
import org.apache.poi.hssf.usermodel.HSSFCellStyle; | |||
import org.apache.poi.hssf.usermodel.HSSFDataFormat; | |||
import org.apache.poi.hssf.usermodel.HSSFRichTextString; | |||
/** | |||
* This class contains code that demonstrates how to insert plain, numbered | |||
* and bulleted lists into an Excel spreadsheet cell. | |||
* | |||
* Look at the code contained in the demonstrateMethodCalls() method. It calls | |||
* other methods that create plain, numbered and bulleted single and | |||
* multi-level lists. The demonstrateMethodCalls() method appears at the top | |||
* of the class definition. | |||
* | |||
* Though different methods are provided to construct single and multi-level | |||
* plain, numbered and bulleted lists, close examination will reveal that they | |||
* are not strictly necessary. If the inputs to the listInCell() and | |||
* multilLevelListInCell() methods are constructed to include the bullet | |||
* character or the item numbers then these methods alone may be sufficient. | |||
* | |||
* @author Mark Beardsley [msb at apache.org] | |||
*/ | |||
public class InCellLists { | |||
// This character looks like a solid, black, loser case letter 'o' | |||
// positioned up from the base line of the text. | |||
private static final char BULLET_CHARACTER = '\u2022'; | |||
// The tab character - \t - cannot be used to create a tab space | |||
// within a cell as it is rendered as a square. Therefore, four | |||
// spaces are used to simulate that character. | |||
private static final String TAB = " "; | |||
/** | |||
* Call each of the list creation methods. | |||
* | |||
* @param outputFilename A String that encapsulates the name of and path to | |||
* the Excel spreadsheet file this code will create. | |||
*/ | |||
public void demonstrateMethodCalls(String outputFilename) throws IOException { | |||
HSSFWorkbook workbook = new HSSFWorkbook(); | |||
try { | |||
HSSFSheet sheet = workbook.createSheet("In Cell Lists"); | |||
HSSFRow row = sheet.createRow(0); | |||
// Create a cell at A1 and insert a single, bulleted, item into | |||
// that cell. | |||
HSSFCell cell = row.createCell(0); | |||
this.bulletedItemInCell(workbook, "List Item", cell); | |||
// Create a cell at A2 and insert a plain list - that is one | |||
// whose items are neither bulleted or numbered - into that cell. | |||
row = sheet.createRow(1); | |||
cell = row.createCell(0); | |||
ArrayList<String> listItems = new ArrayList<String>(); | |||
listItems.add("List Item One."); | |||
listItems.add("List Item Two."); | |||
listItems.add("List Item Three."); | |||
listItems.add("List Item Four."); | |||
this.listInCell(workbook, listItems, cell); | |||
// The row height and cell width are set here to ensure that the | |||
// list may be seen. | |||
row.setHeight((short)1100); | |||
sheet.setColumnWidth(0, 9500); | |||
// Create a cell at A3 and insert a numbered list into that cell. | |||
// Note that a couple of items have been added to the listItems | |||
// ArrayList | |||
row = sheet.createRow(2); | |||
cell = row.createCell(0); | |||
listItems.add("List Item Five."); | |||
listItems.add("List Item Six."); | |||
this.numberedListInCell(workbook, listItems, cell, 1, 2); | |||
row.setHeight((short)1550); | |||
// Create a cell at A4 and insert a numbered list into that cell. | |||
// Note that a couple of items have been added to the listItems | |||
// ArrayList | |||
row = sheet.createRow(3); | |||
cell = row.createCell(0); | |||
listItems.add("List Item Seven."); | |||
listItems.add("List Item Eight."); | |||
listItems.add("List Item Nine."); | |||
listItems.add("List Item Ten."); | |||
this.bulletedListInCell(workbook, listItems, cell); | |||
row.setHeight((short)2550); | |||
// Insert a plain, multi-level list into cell A5. Note that | |||
// the major difference here is that the list items are passed as | |||
// an ArrayList of MultiLevelListItems. Note that an ArrayList | |||
// of instances of an inner class was used here in preference to | |||
// a Hashtable or HashMap as the ArrayList will preserve the | |||
// ordering of the items added to it; the first item added will | |||
// be the first item recovered and the last item added, the last | |||
// item recovered. Alternatively, a LinkedHashMap could be used | |||
// to preserve order. | |||
row = sheet.createRow(4); | |||
cell = row.createCell(0); | |||
ArrayList<MultiLevelListItem> multiLevelListItems = new ArrayList<MultiLevelListItem>(); | |||
listItems = new ArrayList<String>(); | |||
listItems.add("ML List Item One - Sub Item One."); | |||
listItems.add("ML List Item One - Sub Item Two."); | |||
listItems.add("ML List Item One - Sub Item Three."); | |||
listItems.add("ML List Item One - Sub Item Four."); | |||
multiLevelListItems.add(new MultiLevelListItem("List Item One.", listItems)); | |||
// Passing either null or an empty ArrayList will signal that | |||
// there are no lower level items associated with the top level | |||
// item | |||
multiLevelListItems.add(new MultiLevelListItem("List Item Two.", null)); | |||
multiLevelListItems.add(new MultiLevelListItem("List Item Three.", null)); | |||
listItems = new ArrayList<String>(); | |||
listItems.add("ML List Item Four - Sub Item One."); | |||
listItems.add("ML List Item Four - Sub Item Two."); | |||
listItems.add("ML List Item Four - Sub Item Three."); | |||
multiLevelListItems.add(new MultiLevelListItem("List Item Four.", listItems)); | |||
this.multiLevelListInCell(workbook, multiLevelListItems, cell); | |||
row.setHeight((short)2800); | |||
// Insert a numbered multi-level list into cell A6. Note that the | |||
// same ArrayList as constructed for the above plain multi-level | |||
// list example will be re-used | |||
row = sheet.createRow(5); | |||
cell = row.createCell(0); | |||
this.multiLevelNumberedListInCell(workbook, multiLevelListItems, | |||
cell, 1, 1, 1, 2); | |||
row.setHeight((short)2800); | |||
// Insert a numbered multi-level list into cell A7. Note that the | |||
// same ArrayList as constructed for the plain multi-level list | |||
// example will be re-used | |||
row = sheet.createRow(6); | |||
cell = row.createCell(0); | |||
this.multiLevelBulletedListInCell(workbook, multiLevelListItems, cell); | |||
row.setHeight((short)2800); | |||
// Save the completed workbook | |||
FileOutputStream fos = new FileOutputStream(new File(outputFilename)); | |||
try { | |||
workbook.write(fos); | |||
} finally { | |||
fos.close(); | |||
} | |||
} | |||
catch(FileNotFoundException fnfEx) { | |||
System.out.println("Caught a: " + fnfEx.getClass().getName()); | |||
System.out.println("Message: " + fnfEx.getMessage()); | |||
System.out.println("Stacktrace follows..........."); | |||
fnfEx.printStackTrace(System.out); | |||
} | |||
catch(IOException ioEx) { | |||
System.out.println("Caught a: " + ioEx.getClass().getName()); | |||
System.out.println("Message: " + ioEx.getMessage()); | |||
System.out.println("Stacktrace follows..........."); | |||
ioEx.printStackTrace(System.out); | |||
} | |||
finally { | |||
workbook.close(); | |||
} | |||
} | |||
/** | |||
* Inserts a single bulleted item into a cell. | |||
* | |||
* @param workbook A reference to the HSSFWorkbook that 'contains' the | |||
* cell. | |||
* @param listItem An instance of the String class encapsulating the | |||
* items text. | |||
* @param cell An instance of the HSSFCell class that encapsulates a | |||
* reference to the spreadsheet cell into which the list item | |||
* will be written. | |||
*/ | |||
public void bulletedItemInCell(HSSFWorkbook workbook, String listItem, HSSFCell cell) { | |||
// A format String must be built to ensure that the contents of the | |||
// cell appear as a bulleted item. | |||
HSSFDataFormat format = workbook.createDataFormat(); | |||
String formatString = InCellLists.BULLET_CHARACTER + " @"; | |||
int formatIndex = format.getFormat(formatString); | |||
// Construct an HSSFCellStyle and set it's data formt to use the | |||
// object created above. | |||
HSSFCellStyle bulletStyle = workbook.createCellStyle(); | |||
bulletStyle.setDataFormat((short)formatIndex); | |||
// Set the cells contents and style. | |||
cell.setCellValue(new HSSFRichTextString(listItem)); | |||
cell.setCellStyle(bulletStyle); | |||
} | |||
/** | |||
* Inserts a list of plain items - that is items that are neither | |||
* numbered or bulleted - into a single cell. | |||
* | |||
* @param workbook A reference to the HSSFWorkbook that 'contains' the | |||
* cell. | |||
* @param listItems An ArrayList whose elements encapsulate the text for | |||
* the list's items. | |||
* @param cell An instance of the HSSFCell class that encapsulates a | |||
* reference to the spreadsheet cell into which the list | |||
* will be written. | |||
*/ | |||
public void listInCell(HSSFWorkbook workbook, ArrayList<String> listItems, HSSFCell cell) { | |||
StringBuilder buffer = new StringBuilder(); | |||
HSSFCellStyle wrapStyle = workbook.createCellStyle(); | |||
wrapStyle.setWrapText(true); | |||
for(String listItem : listItems) { | |||
buffer.append(listItem); | |||
buffer.append("\n"); | |||
} | |||
// The StringBuffer's contents are the source for the contents | |||
// of the cell. | |||
cell.setCellValue(new HSSFRichTextString(buffer.toString().trim())); | |||
cell.setCellStyle(wrapStyle); | |||
} | |||
/** | |||
* Inserts a numbered list into a single cell. | |||
* | |||
* @param workbook A reference to the HSSFWorkbook that 'contains' the | |||
* cell. | |||
* @param listItems An ArrayList whose elements encapsulate the text for | |||
* the lists items. | |||
* @param cell An instance of the HSSFCell class that encapsulates a | |||
* reference to the spreadsheet cell into which the list | |||
* will be written. | |||
* @param startingValue A primitive int containing the number for the first | |||
* item in the list. | |||
* @param increment A primitive int containing the value that should be used | |||
* to calculate subsequent item numbers. | |||
*/ | |||
public void numberedListInCell(HSSFWorkbook workbook, | |||
ArrayList<String> listItems, | |||
HSSFCell cell, | |||
int startingValue, | |||
int increment) { | |||
StringBuilder buffer = new StringBuilder(); | |||
int itemNumber = startingValue; | |||
// Note that again, an HSSFCellStye object is required and that | |||
// it's wrap text property should be set to 'true' | |||
HSSFCellStyle wrapStyle = workbook.createCellStyle(); | |||
wrapStyle.setWrapText(true); | |||
// Note that the basic method is identical to the listInCell() method | |||
// with one difference; a number prefixed to the items text. | |||
for(String listItem : listItems) { | |||
buffer.append(itemNumber).append(". "); | |||
buffer.append(listItem); | |||
buffer.append("\n"); | |||
itemNumber += increment; | |||
} | |||
// The StringBuffer's contents are the source for the contents | |||
// of the cell. | |||
cell.setCellValue(new HSSFRichTextString(buffer.toString().trim())); | |||
cell.setCellStyle(wrapStyle); | |||
} | |||
/** | |||
* Insert a bulleted list into a cell. | |||
* | |||
* @param workbook A reference to the HSSFWorkbook that 'contains' the | |||
* cell. | |||
* @param listItems An ArrayList whose elements encapsulate the text for | |||
* the lists items. | |||
* @param cell An instance of the HSSFCell class that encapsulates a | |||
* reference to the spreadsheet cell into which the list | |||
* will be written. | |||
*/ | |||
public void bulletedListInCell(HSSFWorkbook workbook, | |||
ArrayList<String> listItems, | |||
HSSFCell cell) { | |||
StringBuilder buffer = new StringBuilder(); | |||
// Note that again, an HSSFCellStye object is required and that | |||
// it's wrap text property should be set to 'true' | |||
HSSFCellStyle wrapStyle = workbook.createCellStyle(); | |||
wrapStyle.setWrapText(true); | |||
// Note that the basic method is identical to the listInCell() method | |||
// with one difference; the bullet character prefixed to the items text. | |||
for(String listItem : listItems) { | |||
buffer.append(InCellLists.BULLET_CHARACTER + " "); | |||
buffer.append(listItem); | |||
buffer.append("\n"); | |||
} | |||
// The StringBuffer's contents are the source for the contents | |||
// of the cell. | |||
cell.setCellValue(new HSSFRichTextString(buffer.toString().trim())); | |||
cell.setCellStyle(wrapStyle); | |||
} | |||
/** | |||
* Insert a multi-level list into a cell. | |||
* | |||
* @param workbook A reference to the HSSFWorkbook that 'contains' the | |||
* cell. | |||
* @param multiLevelListItems An ArrayList whose elements contain instances | |||
* of the MultiLevelListItem class. Each element | |||
* encapsulates the text for the high level item | |||
* along with an ArrayList. Each element of this | |||
* ArrayList encapsulates the text for a lower | |||
* level item. | |||
* @param cell An instance of the HSSFCell class that encapsulates a | |||
* reference to the spreadsheet cell into which the list | |||
* will be written. | |||
*/ | |||
public void multiLevelListInCell(HSSFWorkbook workbook, | |||
ArrayList<MultiLevelListItem> multiLevelListItems, | |||
HSSFCell cell) { | |||
StringBuilder buffer = new StringBuilder(); | |||
// Note that again, an HSSFCellStye object is required and that | |||
// it's wrap text property should be set to 'true' | |||
HSSFCellStyle wrapStyle = workbook.createCellStyle(); | |||
wrapStyle.setWrapText(true); | |||
// Step through the ArrayList of MultilLevelListItem instances. | |||
for(MultiLevelListItem multiLevelListItem : multiLevelListItems) { | |||
// For each element in the ArrayList, get the text for the high | |||
// level list item...... | |||
buffer.append(multiLevelListItem.getItemText()); | |||
buffer.append("\n"); | |||
// and then an ArrayList whose elements encapsulate the text | |||
// for the lower level list items. | |||
ArrayList<String> lowerLevelItems = multiLevelListItem.getLowerLevelItems(); | |||
if(!(lowerLevelItems == null) && !(lowerLevelItems.isEmpty())) { | |||
for(String item : lowerLevelItems) { | |||
buffer.append(InCellLists.TAB); | |||
buffer.append(item); | |||
buffer.append("\n"); | |||
} | |||
} | |||
} | |||
// The StringBuffer's contents are the source for the contents | |||
// of the cell. | |||
cell.setCellValue(new HSSFRichTextString(buffer.toString().trim())); | |||
cell.setCellStyle(wrapStyle); | |||
} | |||
/** | |||
* Insert a multi-level list into a cell. | |||
* | |||
* @param workbook A reference to the HSSFWorkbook that 'contains' the | |||
* cell. | |||
* @param multiLevelListItems An ArrayList whose elements contain instances | |||
* of the MultiLevelListItem class. Each element | |||
* encapsulates the text for the high level item | |||
* along with an ArrayList. Each element of this | |||
* ArrayList encapsulates the text for a lower | |||
* level item. | |||
* @param cell An instance of the HSSFCell class that encapsulates a | |||
* reference to the spreadsheet cell into which the list | |||
* will be written. | |||
* @param highLevelStartingValue A primitive int containing the number | |||
* for the first high level item in the list. | |||
* @param highLevelIncrement A primitive int containing the value that | |||
* should be used to calculate the number of | |||
* subsequent high level item. | |||
* @param lowLevelStartingValue A primitive int will containing the number | |||
* for the first low level item associated | |||
* with a high level item. | |||
* @param lowLevelIncrement A primitive int containing the value that | |||
* should be used to calculate the number of | |||
* subsequent low level item. | |||
*/ | |||
public void multiLevelNumberedListInCell(HSSFWorkbook workbook, | |||
ArrayList<MultiLevelListItem> multiLevelListItems, | |||
HSSFCell cell, | |||
int highLevelStartingValue, | |||
int highLevelIncrement, | |||
int lowLevelStartingValue, | |||
int lowLevelIncrement) { | |||
StringBuilder buffer = new StringBuilder(); | |||
int highLevelItemNumber = highLevelStartingValue; | |||
// Note that again, an HSSFCellStye object is required and that | |||
// it's wrap text property should be set to 'true' | |||
HSSFCellStyle wrapStyle = workbook.createCellStyle(); | |||
wrapStyle.setWrapText(true); | |||
// Step through the ArrayList of MultilLevelListItem instances. | |||
for(MultiLevelListItem multiLevelListItem : multiLevelListItems) { | |||
// For each element in the ArrayList, get the text for the high | |||
// level list item...... | |||
buffer.append(highLevelItemNumber); | |||
buffer.append(". "); | |||
buffer.append(multiLevelListItem.getItemText()); | |||
buffer.append("\n"); | |||
// and then an ArrayList whose elements encapsulate the text | |||
// for the lower level list items. | |||
ArrayList<String> lowerLevelItems = multiLevelListItem.getLowerLevelItems(); | |||
if(!(lowerLevelItems == null) && !(lowerLevelItems.isEmpty())) { | |||
int lowLevelItemNumber = lowLevelStartingValue; | |||
for(String item : lowerLevelItems) { | |||
buffer.append(InCellLists.TAB); | |||
buffer.append(highLevelItemNumber); | |||
buffer.append("."); | |||
buffer.append(lowLevelItemNumber); | |||
buffer.append(" "); | |||
buffer.append(item); | |||
buffer.append("\n"); | |||
lowLevelItemNumber += lowLevelIncrement; | |||
} | |||
} | |||
highLevelItemNumber += highLevelIncrement; | |||
} | |||
// The StringBuffer's contents are the source for the contents | |||
// of the cell. | |||
cell.setCellValue(new HSSFRichTextString(buffer.toString().trim())); | |||
cell.setCellStyle(wrapStyle); | |||
} | |||
/** | |||
* Insert a bulleted multi-level list into a cell. | |||
* | |||
* @param workbook A reference to the HSSFWorkbook that 'contains' the | |||
* cell. | |||
* @param multiLevelListItems An ArrayList whose elements contain instances | |||
* of the MultiLevelListItem class. Each element | |||
* encapsulates the text for the high level item | |||
* along with an ArrayList. Each element of this | |||
* ArrayList encapsulates the text for a lower | |||
* level item. | |||
* @param cell An instance of the HSSFCell class that encapsulates a | |||
* reference to the spreadsheet cell into which the list | |||
* will be written. | |||
*/ | |||
public void multiLevelBulletedListInCell(HSSFWorkbook workbook, | |||
ArrayList<MultiLevelListItem> multiLevelListItems, | |||
HSSFCell cell) { | |||
StringBuilder buffer = new StringBuilder(); | |||
// Note that again, an HSSFCellStye object is required and that | |||
// it's wrap text property should be set to 'true' | |||
HSSFCellStyle wrapStyle = workbook.createCellStyle(); | |||
wrapStyle.setWrapText(true); | |||
// Step through the ArrayList of MultilLevelListItem instances. | |||
for(MultiLevelListItem multiLevelListItem : multiLevelListItems) { | |||
// For each element in the ArrayList, get the text for the high | |||
// level list item...... | |||
buffer.append(InCellLists.BULLET_CHARACTER); | |||
buffer.append(" "); | |||
buffer.append(multiLevelListItem.getItemText()); | |||
buffer.append("\n"); | |||
// and then an ArrayList whose elements encapsulate the text | |||
// for the lower level list items. | |||
ArrayList<String> lowerLevelItems = multiLevelListItem.getLowerLevelItems(); | |||
if(!(lowerLevelItems == null) && !(lowerLevelItems.isEmpty())) { | |||
for(String item : lowerLevelItems) { | |||
buffer.append(InCellLists.TAB); | |||
buffer.append(InCellLists.BULLET_CHARACTER); | |||
buffer.append(" "); | |||
buffer.append(item); | |||
buffer.append("\n"); | |||
} | |||
} | |||
} | |||
// The StringBuffer's contents are the source for the contents | |||
// of the cell. | |||
cell.setCellValue(new HSSFRichTextString(buffer.toString().trim())); | |||
cell.setCellStyle(wrapStyle); | |||
} | |||
/** | |||
* The main entry point to the program. Demonstrates how to call the method | |||
* that will create an Excel workbook containing many different sorts of | |||
* lists. | |||
* | |||
* @param args the command line arguments. | |||
*/ | |||
public static void main(String[] args) throws IOException { | |||
new InCellLists().demonstrateMethodCalls("Latest In Cell List.xls"); | |||
} | |||
/** | |||
* An instance of this inner class models an item or element in a | |||
* multi-level list. Each multi-level list item consists of the text for the | |||
* high level items and an ArrayList containing the text for each of the | |||
* associated lower level items. When written into a cell, each multi-level | |||
* list item will have this general appearance. | |||
* | |||
* Item One | |||
* Sub Item One. | |||
* Sub Item Two. | |||
* Item Two | |||
* Sub Item One. | |||
* Sub Item Two. | |||
* etc. | |||
* | |||
* It would be quite possible to modify this class to model much more | |||
* complex list structures descending through two, three or even more | |||
* levels. | |||
*/ | |||
public final class MultiLevelListItem { | |||
private String itemText = null; | |||
private ArrayList<String> lowerLevelItems = null; | |||
/** | |||
* Create a new instance of the MultiLevelListItem class using the | |||
* following parameters. | |||
* | |||
* @param itemText A String that encapsulates the text for the high | |||
* level list item. | |||
* @param lowerLevelItems An ArrayList whose elements encapsulate the | |||
* text for the associated lower level list | |||
* items. | |||
*/ | |||
public MultiLevelListItem(String itemText, ArrayList<String> lowerLevelItems) { | |||
this.itemText = itemText; | |||
this.lowerLevelItems = lowerLevelItems; | |||
} | |||
/** | |||
* Get the text for the high level list item. | |||
* | |||
* @return A String that encapsulates the text for the high level list | |||
* item. | |||
*/ | |||
public String getItemText() { | |||
return(this.itemText); | |||
} | |||
/** | |||
* Get the text for the associated lower level list items. | |||
* | |||
* @return An ArrayList whose elements each encapsulate the text for a | |||
* single associated lower level list item. | |||
*/ | |||
public ArrayList<String> getLowerLevelItems() { | |||
return(this.lowerLevelItems); | |||
} | |||
} | |||
} |
@@ -1,47 +0,0 @@ | |||
/* ==================================================================== | |||
Licensed to the Apache Software Foundation (ASF) under one or more | |||
contributor license agreements. See the NOTICE file distributed with | |||
this work for additional information regarding copyright ownership. | |||
The ASF licenses this file to You under the Apache License, Version 2.0 | |||
(the "License"); you may not use this file except in compliance with | |||
the License. You may obtain a copy of the License at | |||
http://www.apache.org/licenses/LICENSE-2.0 | |||
Unless required by applicable law or agreed to in writing, software | |||
distributed under the License is distributed on an "AS IS" BASIS, | |||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | |||
See the License for the specific language governing permissions and | |||
limitations under the License. | |||
==================================================================== */ | |||
package org.apache.poi.hssf.usermodel.examples; | |||
import org.apache.poi.hssf.usermodel.*; | |||
import org.apache.poi.ss.util.CellRangeAddress; | |||
import java.io.IOException; | |||
import java.io.FileOutputStream; | |||
/** | |||
* An example of how to merge regions of cells. | |||
* | |||
* @author Glen Stampoultzis (glens at apache.org) | |||
*/ | |||
public class MergedCells { | |||
public static void main(String[] args) throws IOException { | |||
HSSFWorkbook wb = new HSSFWorkbook(); | |||
HSSFSheet sheet = wb.createSheet("new sheet"); | |||
HSSFRow row = sheet.createRow(1); | |||
HSSFCell cell = row.createCell(1); | |||
cell.setCellValue("This is a test of merging"); | |||
sheet.addMergedRegion(new CellRangeAddress(1, 1, 1, 2)); | |||
// Write the output to a file | |||
FileOutputStream fileOut = new FileOutputStream("workbook.xls"); | |||
wb.write(fileOut); | |||
fileOut.close(); | |||
} | |||
} |