@Component @Named(value="officeimporter") @Singleton public class OfficeImporterScriptService extends Object implements org.xwiki.script.service.ScriptService
Modifier and Type | Field and Description |
---|---|
static String |
OFFICE_IMPORTER_ERROR
The key used to place any error messages while importing office documents.
|
Constructor and Description |
---|
OfficeImporterScriptService() |
Modifier and Type | Method and Description |
---|---|
String |
getErrorMessage() |
XDOMOfficeDocument |
officeToXDOM(InputStream officeFileStream,
String officeFileName,
org.xwiki.model.reference.DocumentReference targetDocumentReference,
boolean filterStyles)
Imports the given office document into an
XDOMOfficeDocument . |
XDOMOfficeDocument |
officeToXDOM(InputStream officeFileStream,
String officeFileName,
String referenceDocument,
boolean filterStyles)
Deprecated.
|
XHTMLOfficeDocument |
officeToXHTML(InputStream officeFileStream,
String officeFileName,
org.xwiki.model.reference.DocumentReference targetDocumentReference,
boolean filterStyles)
Imports the given office document into an
XHTMLOfficeDocument . |
XHTMLOfficeDocument |
officeToXHTML(InputStream officeFileStream,
String officeFileName,
String referenceDocument,
boolean filterStyles)
Deprecated.
|
boolean |
save(XDOMOfficeDocument doc,
org.xwiki.model.reference.DocumentReference documentReference,
org.xwiki.model.reference.DocumentReference parentReference,
String title,
boolean append)
Attempts to save the given
XDOMOfficeDocument into the target wiki page specified by arguments (using
the default content syntax, see ExtendedRenderingConfiguration.getDefaultContentSyntax() ). |
boolean |
save(XDOMOfficeDocument doc,
org.xwiki.model.reference.DocumentReference documentReference,
String syntaxId,
org.xwiki.model.reference.DocumentReference parentReference,
String title,
boolean append)
Attempts to save the given
XDOMOfficeDocument into the target wiki page specified by arguments. |
boolean |
save(XDOMOfficeDocument doc,
String target,
String syntaxId,
String parent,
String title,
boolean append)
Deprecated.
|
Map<TargetDocumentDescriptor,XDOMOfficeDocument> |
split(XDOMOfficeDocument xdomDocument,
String[] headingLevels,
String namingCriterionHint,
org.xwiki.model.reference.DocumentReference rootDocumentReference)
Splits the given
XDOMOfficeDocument into multiple XDOMOfficeDocument instances according to the
specified criterion. |
Map<TargetDocumentDescriptor,XDOMOfficeDocument> |
split(XDOMOfficeDocument xdomDocument,
String[] headingLevels,
String namingCriterionHint,
String rootDocumentName)
Deprecated.
|
XDOMOfficeDocument |
xhtmlToXDOM(XHTMLOfficeDocument xhtmlOfficeDocument)
Imports the given
XHTMLOfficeDocument into an XDOMOfficeDocument . |
public static final String OFFICE_IMPORTER_ERROR
public XHTMLOfficeDocument officeToXHTML(InputStream officeFileStream, String officeFileName, org.xwiki.model.reference.DocumentReference targetDocumentReference, boolean filterStyles)
XHTMLOfficeDocument
.officeFileStream
- binary data stream corresponding to input office documentofficeFileName
- name of the input office document, this argument is mainly used for determining input
document format where necessarytargetDocumentReference
- the document the import process is carried out relative to; this argument affects
the attachment URLs generated during the import process where all references to attachments will be
calculated assuming that the attachments are contained on the specified target documentfilterStyles
- whether to filter styling information associated with the office document's content or notXHTMLOfficeDocument
containing xhtml result of the import operation or null if an error occurspublic XHTMLOfficeDocument officeToXHTML(InputStream officeFileStream, String officeFileName, String referenceDocument, boolean filterStyles)
officeToXHTML(InputStream, String, DocumentReference, boolean)
insteadXHTMLOfficeDocument
.officeFileStream
- binary data stream corresponding to input office documentofficeFileName
- name of the input office document, this argument is mainly used for determining input
document format where necessaryreferenceDocument
- reference wiki document w.r.t which import process is carried out; this argument affects
the attachment URLs generated during the import process where all references to attachments will be
calculated assuming that the attachments are contained on the reference documentfilterStyles
- whether to filter styling information associated with the office document's content or notXHTMLOfficeDocument
containing xhtml result of the import operation or null if an error occurspublic XDOMOfficeDocument xhtmlToXDOM(XHTMLOfficeDocument xhtmlOfficeDocument)
XHTMLOfficeDocument
into an XDOMOfficeDocument
.xhtmlOfficeDocument
- XHTMLOfficeDocument
to be importedXDOMOfficeDocument
containing XDOM
result of the import
operation or null if an error occurspublic XDOMOfficeDocument officeToXDOM(InputStream officeFileStream, String officeFileName, org.xwiki.model.reference.DocumentReference targetDocumentReference, boolean filterStyles)
XDOMOfficeDocument
.officeFileStream
- binary data stream corresponding to input office documentofficeFileName
- name of the input office document, this argument is mainly is used for determining input
document format where necessarytargetDocumentReference
- the document the import process is carried out relative to; this argument affects
the attachment URLs generated during the import process where all references to attachments will be
calculated assuming that the attachments are contained on the specified target documentfilterStyles
- whether to filter styling information associated with the office document's content or notXDOMOfficeDocument
containing XDOM
result of the import
operation or null if an error occurspublic XDOMOfficeDocument officeToXDOM(InputStream officeFileStream, String officeFileName, String referenceDocument, boolean filterStyles)
officeToXDOM(InputStream, String, DocumentReference, boolean)
insteadXDOMOfficeDocument
.officeFileStream
- binary data stream corresponding to input office documentofficeFileName
- name of the input office document, this argument is mainly is used for determining input
document format where necessaryreferenceDocument
- reference wiki document w.r.t which import process is carried out; this srgument affects
the attachment URLs generated during the import process where all references to attachments will be
calculated assuming that the attachments are contained on the reference documentfilterStyles
- whether to filter styling information associated with the office document's content or notXDOMOfficeDocument
containing XDOM
result of the import
operation or null if an error occurspublic Map<TargetDocumentDescriptor,XDOMOfficeDocument> split(XDOMOfficeDocument xdomDocument, String[] headingLevels, String namingCriterionHint, org.xwiki.model.reference.DocumentReference rootDocumentReference)
XDOMOfficeDocument
into multiple XDOMOfficeDocument
instances according to the
specified criterion. This method is useful when a single office document has to be imported and split into
multiple wiki pages. An auto generated TOC structure will be returned associated to rootDocumentName
TargetDocumentDescriptor
entry.xdomDocument
- XDOMOfficeDocument
to be splitheadingLevels
- heading levels defining the split points on the original documentnamingCriterionHint
- hint indicating the child pages naming criterionrootDocumentReference
- the reference of the root document w.r.t which splitting will occur; in the results
set the entry corresponding to the root document TargetDocumentDescriptor
will hold an
auto-generated TOC structureXDOMOfficeDocument
fragments against corresponding TargetDocumentDescriptor
instances or null if an error occurspublic Map<TargetDocumentDescriptor,XDOMOfficeDocument> split(XDOMOfficeDocument xdomDocument, String[] headingLevels, String namingCriterionHint, String rootDocumentName)
split(XDOMOfficeDocument, String[], String, DocumentReference)
insteadXDOMOfficeDocument
into multiple XDOMOfficeDocument
instances according to the
specified criterion. This method is useful when a single office document has to be imported and split into
multiple wiki pages. An auto generated TOC structure will be returned associated to rootDocumentName
TargetDocumentDescriptor
entry.xdomDocument
- XDOMOfficeDocument
to be splitheadingLevels
- heading levels defining the split points on the original documentnamingCriterionHint
- hint indicating the child pages naming criterionrootDocumentName
- name of the root document w.r.t which splitting will occur; in the results set the entry
corresponding to rootDocumentName TargetDocumentDescriptor
will hold an auto-generated
TOC structureXDOMOfficeDocument
fragments against corresponding TargetDocumentDescriptor
instances or null if an error occurspublic boolean save(XDOMOfficeDocument doc, org.xwiki.model.reference.DocumentReference documentReference, org.xwiki.model.reference.DocumentReference parentReference, String title, boolean append)
XDOMOfficeDocument
into the target wiki page specified by arguments (using
the default content syntax, see ExtendedRenderingConfiguration.getDefaultContentSyntax()
).doc
- XDOMOfficeDocument
to be saveddocumentReference
- the reference of the target wiki pageparentReference
- the reference of the parent wiki page or null
title
- title of the target wiki page or null
append
- whether to append content if the target wiki page existspublic boolean save(XDOMOfficeDocument doc, org.xwiki.model.reference.DocumentReference documentReference, String syntaxId, org.xwiki.model.reference.DocumentReference parentReference, String title, boolean append)
XDOMOfficeDocument
into the target wiki page specified by arguments.doc
- XDOMOfficeDocument
to be saveddocumentReference
- the reference of the target wiki pagesyntaxId
- syntax of the target wiki pageparentReference
- the reference of the parent wiki page or null
title
- title of the target wiki page or null
append
- whether to append content if the target wiki page existspublic boolean save(XDOMOfficeDocument doc, String target, String syntaxId, String parent, String title, boolean append)
save(XDOMOfficeDocument, DocumentReference, String, DocumentReference, String, boolean)
insteadXDOMOfficeDocument
into the target wiki page specified by arguments.doc
- XDOMOfficeDocument
to be savedtarget
- name of the target wiki pagesyntaxId
- syntax of the target wiki pageparent
- name of the parent wiki page or nulltitle
- title of the target wiki page or nullappend
- whether to append content if the target wiki page existspublic String getErrorMessage()
Copyright © 2004–2021 XWiki. All rights reserved.