Filter Options

From Apache OpenOffice Wiki
Jump to: navigation, search

The method filter() takes a sequence of PropertyValue structs describing the filter parameters. The following properties from the are supported:

Properties of supported by GraphicExportFilter
MediaType Depending on the export filters supported by this component, this is the mime type of the target graphic file. The mime types currently supported are:

image/x-MS-bmp application/dxf application/postscript image/gif image/jpeg image/png image/x-pict image/x-pcx image/x-portable-bitmap image/x-portable-graymap image/x-portable-pixmap image/x-cmu-raster image/targa image/tiff image/x-xbitmap image/x-xpixmap image/svg+xml

FilterName This property can been used if no MediaType exists with "Windows Metafile" or "Enhanced Metafile". FilterName has to be set to the extension of these graphic formats (WMF, EMF, BMP).
URL The target URL of the file that is created during export.
Documentation note.png If necessary, use the interface XMimeTypeInfo to get all mime types supported by the GraphicExportFilter. It offers the following methods:
  boolean supportsMimeType( [in] string MimeTypeName )
  sequence< string > getSupportedMimeTypeNames()

XMimeTypeInfo is currently not supported by the GraphicExportFilter.

The following example exports a draw page xPage from a given document xDrawDoc:

  //get draw pages xPageSupplier = (
      UnoRuntime.queryInterface(, xDrawDoc); xDrawPages = xPageSupplier.getDrawPages();
  // first page
  Object page = xDrawPages.getByIndex(0); xPage = (, page);
  Object GraphicExportFilter = xServiceFactory.createInstance(
  // use the XExporter interface to set xPage as source component 
  // for the GraphicExportFilter
  XExporter xExporter = (XExporter)UnoRuntime.queryInterface( 
      XExporter.class, GraphicExportFilter );
  XComponent xComp = (XComponent)UnoRuntime.queryInterface(XComponent.class, xPage);
  // prepare the media descriptor for the filter() method in XFilter
  PropertyValue aProps[] = new PropertyValue[2];
  aProps[0] = new PropertyValue();
  aProps[0].Name = "MediaType";
  aProps[0].Value = "image/gif";
  // for some graphic formats, e.g. Windows Metafile, there is no Mime type,
  // therefore it is also possible to use the property FilterName with
  // Filter names as defined in the file TypeDetection.xml (see "Storing")
  /* aProps[0].Name = "FilterName";
     aProps[0].Value = "WMF - MS Windows Metafile";
  aProps[1] = new PropertyValue();
  aProps[1].Name = "URL";
  aProps[1].Value = "file:///home/images/page1.gif";
  // get XFilter interface and launch the export
  XFilter xFilter = (XFilter) UnoRuntime.queryInterface(
      XFilter.class, GraphicExportFilter);
Content on this page is licensed under the Public Documentation License (PDL).
Personal tools
In other languages