/** * @param filenameHint * @param altText * @param id1 * @param id2 * @param link * @param maxWidth * @return * @throws Exception * @since 3.3.0 */ public Inline createImageInline(String filenameHint, String altText, int id1, int id2, boolean link, int maxWidth) throws Exception { // This signature can scale the image to specified maxWidth WordprocessingMLPackage wmlPackage = ((WordprocessingMLPackage) this.getPackage()); List<SectionWrapper> sections = wmlPackage.getDocumentModel().getSections(); PageDimensions page = sections.get(sections.size() - 1).getPageDimensions(); CxCy cxcy = CxCy.scale(imageInfo, page, maxWidth); return createImageInline(filenameHint, altText, id1, id2, cxcy.getCx(), cxcy.getCy(), link); }
/** * Create a <wp:inline> element suitable for this image, * which can be linked or embedded in w:p/w:r/w:drawing. * If the image is wider than the page, it will be scaled * automatically. * @param filenameHint Any text, for example the original filename * @param altText Like HTML's alt text * @param id1 An id unique in the document * @param id2 Another id unique in the document * @param link true if this is to be linked not embedded * None of these things seem to be exposed in Word 2007's * user interface, but Word won't open the document if * any of the attributes these go in (except @ desc) aren't present! * @throws Exception */ public Inline createImageInline(String filenameHint, String altText, int id1, int id2, boolean link) throws Exception { WordprocessingMLPackage wmlPackage = ((WordprocessingMLPackage) this.getPackage()); List<SectionWrapper> sections = wmlPackage.getDocumentModel().getSections(); PageDimensions page = sections.get(sections.size() - 1).getPageDimensions(); CxCy cxcy = CxCy.scale(imageInfo, page); return createImageInline(filenameHint, altText, id1, id2, cxcy.getCx(), cxcy.getCy(), link); }
String altText = attributes.contains("alt") ? attributes.getValue("alt") : ""; List<SectionWrapper> sections = docx.getPackage().getDocumentModel().getSections(); PageDimensions page = sections.get(sections.size() - 1).getPageDimensions(); double writableWidthTwips = page.getWritableWidthTwips();
/** * @param filenameHint * @param altText * @param id1 * @param id2 * @param link * @param maxWidth * @return * @throws Exception * @since 3.3.0 */ public Inline createImageInline(String filenameHint, String altText, int id1, int id2, boolean link, int maxWidth) throws Exception { // This signature can scale the image to specified maxWidth WordprocessingMLPackage wmlPackage = ((WordprocessingMLPackage) this.getPackage()); List<SectionWrapper> sections = wmlPackage.getDocumentModel().getSections(); PageDimensions page = sections.get(sections.size() - 1).getPageDimensions(); CxCy cxcy = CxCy.scale(imageInfo, page, maxWidth); return createImageInline(filenameHint, altText, id1, id2, cxcy.getCx(), cxcy.getCy(), link); }
/** * Create a <wp:inline> element suitable for this image, * which can be linked or embedded in w:p/w:r/w:drawing. * If the image is wider than the page, it will be scaled * automatically. * @param filenameHint Any text, for example the original filename * @param altText Like HTML's alt text * @param id1 An id unique in the document * @param id2 Another id unique in the document * @param link true if this is to be linked not embedded * None of these things seem to be exposed in Word 2007's * user interface, but Word won't open the document if * any of the attributes these go in (except @ desc) aren't present! * @throws Exception */ public Inline createImageInline(String filenameHint, String altText, int id1, int id2, boolean link) throws Exception { WordprocessingMLPackage wmlPackage = ((WordprocessingMLPackage) this.getPackage()); List<SectionWrapper> sections = wmlPackage.getDocumentModel().getSections(); PageDimensions page = sections.get(sections.size() - 1).getPageDimensions(); CxCy cxcy = CxCy.scale(imageInfo, page); return createImageInline(filenameHint, altText, id1, id2, cxcy.getCx(), cxcy.getCy(), link); }
if (reportRegion.isTabulatedRegion()) { mainDocumentPart.addParagraphOfText(""); int writableWidthTwips = wordMLPackage.getDocumentModel().getSections().get(0).getPageDimensions().getWritableWidthTwips(); int cols = reportRegion.getRegionProperties().size(); int cellWidthTwips = new Double(Math.floor((writableWidthTwips / cols))).intValue();