try {
thumbnailPartName = PackagingURIHelper
.createPartName("/docProps/thumbnail"
+ path.substring(path.lastIndexOf(".") + 1));
} catch (InvalidFormatException e2) {
throw new InvalidOperationException(
"Can't add a thumbnail file named '" + filename + "'");
}
}
// Check if part already exist
if (this.getPart(thumbnailPartName) != null)
throw new InvalidOperationException(
"You already add a thumbnail named '" + filename + "'");
// Add the thumbnail part to this package.
PackagePart thumbnailPart = this.createPart(thumbnailPartName,
contentType, false);