public class FieldImport extends Field
To learn more, visit the Working with Fields documentation article.
Remarks:
Retrieves the picture contained in the document.
Examples:
Shows how to insert images using IMPORT and INCLUDEPICTURE fields.
Document doc = new Document();
DocumentBuilder builder = new DocumentBuilder(doc);
// Below are two similar field types that we can use to display images linked from the local file system.
// 1 - The INCLUDEPICTURE field:
FieldIncludePicture fieldIncludePicture = (FieldIncludePicture) builder.insertField(FieldType.FIELD_INCLUDE_PICTURE, true);
fieldIncludePicture.setSourceFullName(getImageDir() + "Transparent background logo.png");
Assert.assertTrue(fieldIncludePicture.getFieldCode().matches(" INCLUDEPICTURE .*"));
// Apply the PNG32.FLT filter.
fieldIncludePicture.setGraphicFilter("PNG32");
fieldIncludePicture.isLinked(true);
fieldIncludePicture.setResizeHorizontally(true);
fieldIncludePicture.setResizeVertically(true);
// 2 - The IMPORT field:
FieldImport fieldImport = (FieldImport) builder.insertField(FieldType.FIELD_IMPORT, true);
fieldImport.setSourceFullName(getImageDir() + "Transparent background logo.png");
fieldImport.setGraphicFilter("PNG32");
fieldImport.isLinked(true);
Assert.assertTrue(fieldImport.getFieldCode().matches(" IMPORT .* \\\\c PNG32 \\\\d"));
doc.updateFields();
doc.save(getArtifactsDir() + "Field.IMPORT.INCLUDEPICTURE.docx");
| Modifier and Type | Method and Description |
|---|---|
java.lang.String |
getGraphicFilter()
Gets the name of the filter for the format of the graphic that is to be inserted.
|
java.lang.String |
getSourceFullName()
Gets the location of the picture.
|
int |
getSwitchType(java.lang.String switchName) |
boolean |
isLinked()
Gets whether to reduce the file size by not storing graphics data with the document.
|
void |
isLinked(boolean value)
Sets whether to reduce the file size by not storing graphics data with the document.
|
void |
setGraphicFilter(java.lang.String value)
Sets the name of the filter for the format of the graphic that is to be inserted.
|
void |
setSourceFullName(java.lang.String value)
Sets the location of the picture.
|
getDisplayResult, getEnd, getFieldCode, getFieldCode, getFormat, getLocaleId, getResult, getSeparator, getStart, getType, isDirty, isDirty, isLocked, isLocked, needStoreOldResultNodes, remove, setLocaleId, setResult, unlink, update, updatepublic java.lang.String getSourceFullName()
Examples:
Shows how to insert images using IMPORT and INCLUDEPICTURE fields.
Document doc = new Document();
DocumentBuilder builder = new DocumentBuilder(doc);
// Below are two similar field types that we can use to display images linked from the local file system.
// 1 - The INCLUDEPICTURE field:
FieldIncludePicture fieldIncludePicture = (FieldIncludePicture) builder.insertField(FieldType.FIELD_INCLUDE_PICTURE, true);
fieldIncludePicture.setSourceFullName(getImageDir() + "Transparent background logo.png");
Assert.assertTrue(fieldIncludePicture.getFieldCode().matches(" INCLUDEPICTURE .*"));
// Apply the PNG32.FLT filter.
fieldIncludePicture.setGraphicFilter("PNG32");
fieldIncludePicture.isLinked(true);
fieldIncludePicture.setResizeHorizontally(true);
fieldIncludePicture.setResizeVertically(true);
// 2 - The IMPORT field:
FieldImport fieldImport = (FieldImport) builder.insertField(FieldType.FIELD_IMPORT, true);
fieldImport.setSourceFullName(getImageDir() + "Transparent background logo.png");
fieldImport.setGraphicFilter("PNG32");
fieldImport.isLinked(true);
Assert.assertTrue(fieldImport.getFieldCode().matches(" IMPORT .* \\\\c PNG32 \\\\d"));
doc.updateFields();
doc.save(getArtifactsDir() + "Field.IMPORT.INCLUDEPICTURE.docx");
public void setSourceFullName(java.lang.String value)
throws java.lang.Exception
Examples:
Shows how to insert images using IMPORT and INCLUDEPICTURE fields.
Document doc = new Document();
DocumentBuilder builder = new DocumentBuilder(doc);
// Below are two similar field types that we can use to display images linked from the local file system.
// 1 - The INCLUDEPICTURE field:
FieldIncludePicture fieldIncludePicture = (FieldIncludePicture) builder.insertField(FieldType.FIELD_INCLUDE_PICTURE, true);
fieldIncludePicture.setSourceFullName(getImageDir() + "Transparent background logo.png");
Assert.assertTrue(fieldIncludePicture.getFieldCode().matches(" INCLUDEPICTURE .*"));
// Apply the PNG32.FLT filter.
fieldIncludePicture.setGraphicFilter("PNG32");
fieldIncludePicture.isLinked(true);
fieldIncludePicture.setResizeHorizontally(true);
fieldIncludePicture.setResizeVertically(true);
// 2 - The IMPORT field:
FieldImport fieldImport = (FieldImport) builder.insertField(FieldType.FIELD_IMPORT, true);
fieldImport.setSourceFullName(getImageDir() + "Transparent background logo.png");
fieldImport.setGraphicFilter("PNG32");
fieldImport.isLinked(true);
Assert.assertTrue(fieldImport.getFieldCode().matches(" IMPORT .* \\\\c PNG32 \\\\d"));
doc.updateFields();
doc.save(getArtifactsDir() + "Field.IMPORT.INCLUDEPICTURE.docx");
value - The location of the picture.java.lang.Exceptionpublic java.lang.String getGraphicFilter()
Examples:
Shows how to insert images using IMPORT and INCLUDEPICTURE fields.
Document doc = new Document();
DocumentBuilder builder = new DocumentBuilder(doc);
// Below are two similar field types that we can use to display images linked from the local file system.
// 1 - The INCLUDEPICTURE field:
FieldIncludePicture fieldIncludePicture = (FieldIncludePicture) builder.insertField(FieldType.FIELD_INCLUDE_PICTURE, true);
fieldIncludePicture.setSourceFullName(getImageDir() + "Transparent background logo.png");
Assert.assertTrue(fieldIncludePicture.getFieldCode().matches(" INCLUDEPICTURE .*"));
// Apply the PNG32.FLT filter.
fieldIncludePicture.setGraphicFilter("PNG32");
fieldIncludePicture.isLinked(true);
fieldIncludePicture.setResizeHorizontally(true);
fieldIncludePicture.setResizeVertically(true);
// 2 - The IMPORT field:
FieldImport fieldImport = (FieldImport) builder.insertField(FieldType.FIELD_IMPORT, true);
fieldImport.setSourceFullName(getImageDir() + "Transparent background logo.png");
fieldImport.setGraphicFilter("PNG32");
fieldImport.isLinked(true);
Assert.assertTrue(fieldImport.getFieldCode().matches(" IMPORT .* \\\\c PNG32 \\\\d"));
doc.updateFields();
doc.save(getArtifactsDir() + "Field.IMPORT.INCLUDEPICTURE.docx");
public void setGraphicFilter(java.lang.String value)
throws java.lang.Exception
Examples:
Shows how to insert images using IMPORT and INCLUDEPICTURE fields.
Document doc = new Document();
DocumentBuilder builder = new DocumentBuilder(doc);
// Below are two similar field types that we can use to display images linked from the local file system.
// 1 - The INCLUDEPICTURE field:
FieldIncludePicture fieldIncludePicture = (FieldIncludePicture) builder.insertField(FieldType.FIELD_INCLUDE_PICTURE, true);
fieldIncludePicture.setSourceFullName(getImageDir() + "Transparent background logo.png");
Assert.assertTrue(fieldIncludePicture.getFieldCode().matches(" INCLUDEPICTURE .*"));
// Apply the PNG32.FLT filter.
fieldIncludePicture.setGraphicFilter("PNG32");
fieldIncludePicture.isLinked(true);
fieldIncludePicture.setResizeHorizontally(true);
fieldIncludePicture.setResizeVertically(true);
// 2 - The IMPORT field:
FieldImport fieldImport = (FieldImport) builder.insertField(FieldType.FIELD_IMPORT, true);
fieldImport.setSourceFullName(getImageDir() + "Transparent background logo.png");
fieldImport.setGraphicFilter("PNG32");
fieldImport.isLinked(true);
Assert.assertTrue(fieldImport.getFieldCode().matches(" IMPORT .* \\\\c PNG32 \\\\d"));
doc.updateFields();
doc.save(getArtifactsDir() + "Field.IMPORT.INCLUDEPICTURE.docx");
value - The name of the filter for the format of the graphic that is to be inserted.java.lang.Exceptionpublic boolean isLinked()
Examples:
Shows how to insert images using IMPORT and INCLUDEPICTURE fields.
Document doc = new Document();
DocumentBuilder builder = new DocumentBuilder(doc);
// Below are two similar field types that we can use to display images linked from the local file system.
// 1 - The INCLUDEPICTURE field:
FieldIncludePicture fieldIncludePicture = (FieldIncludePicture) builder.insertField(FieldType.FIELD_INCLUDE_PICTURE, true);
fieldIncludePicture.setSourceFullName(getImageDir() + "Transparent background logo.png");
Assert.assertTrue(fieldIncludePicture.getFieldCode().matches(" INCLUDEPICTURE .*"));
// Apply the PNG32.FLT filter.
fieldIncludePicture.setGraphicFilter("PNG32");
fieldIncludePicture.isLinked(true);
fieldIncludePicture.setResizeHorizontally(true);
fieldIncludePicture.setResizeVertically(true);
// 2 - The IMPORT field:
FieldImport fieldImport = (FieldImport) builder.insertField(FieldType.FIELD_IMPORT, true);
fieldImport.setSourceFullName(getImageDir() + "Transparent background logo.png");
fieldImport.setGraphicFilter("PNG32");
fieldImport.isLinked(true);
Assert.assertTrue(fieldImport.getFieldCode().matches(" IMPORT .* \\\\c PNG32 \\\\d"));
doc.updateFields();
doc.save(getArtifactsDir() + "Field.IMPORT.INCLUDEPICTURE.docx");
public void isLinked(boolean value)
throws java.lang.Exception
Examples:
Shows how to insert images using IMPORT and INCLUDEPICTURE fields.
Document doc = new Document();
DocumentBuilder builder = new DocumentBuilder(doc);
// Below are two similar field types that we can use to display images linked from the local file system.
// 1 - The INCLUDEPICTURE field:
FieldIncludePicture fieldIncludePicture = (FieldIncludePicture) builder.insertField(FieldType.FIELD_INCLUDE_PICTURE, true);
fieldIncludePicture.setSourceFullName(getImageDir() + "Transparent background logo.png");
Assert.assertTrue(fieldIncludePicture.getFieldCode().matches(" INCLUDEPICTURE .*"));
// Apply the PNG32.FLT filter.
fieldIncludePicture.setGraphicFilter("PNG32");
fieldIncludePicture.isLinked(true);
fieldIncludePicture.setResizeHorizontally(true);
fieldIncludePicture.setResizeVertically(true);
// 2 - The IMPORT field:
FieldImport fieldImport = (FieldImport) builder.insertField(FieldType.FIELD_IMPORT, true);
fieldImport.setSourceFullName(getImageDir() + "Transparent background logo.png");
fieldImport.setGraphicFilter("PNG32");
fieldImport.isLinked(true);
Assert.assertTrue(fieldImport.getFieldCode().matches(" IMPORT .* \\\\c PNG32 \\\\d"));
doc.updateFields();
doc.save(getArtifactsDir() + "Field.IMPORT.INCLUDEPICTURE.docx");
value - Whether to reduce the file size by not storing graphics data with the document.java.lang.Exceptionpublic int getSwitchType(java.lang.String switchName)