मैं इस तरह कुछ कोड के माध्यम से कार्यपत्रक के लिए एक छवि को जोड़ने हूँ:POI एक्सेल HSSFPicture छवि और आकार
// Create the drawing patriarch. This is the top level container for all shapes.
Drawing drawing = sheet.createDrawingPatriarch();
//add a picture shape
//ClientAnchor anchor = this.creationHelper.createClientAnchor();
ClientAnchor anchor = new HSSFClientAnchor((short)0, (short)0, (short)0, (short)0, (short)0, (short)0, (short)2, (short)5)
// 0 = Move and size with Cells, 2 = Move but don't size with cells, 3 = Don't move or size with cells.
anchor.setAnchorType(2)
HSSFPicture pict = drawing.createPicture(anchor, this.images.get("logo"));
pict.resize() ;
हालांकि बस के बाद छवियों जोड़ रहे हैं, मैं कॉलम का आकार परिवर्तन - जो गंदगी बातें करने लगता है। यह छवियों का आकार बदलता है - जो मैं नहीं चाहता हूं।
//psuedo code
public void autoSizeColumns() {
def cols = (StartColumn..this.cMax)
cols.each { i ->
sheet.autoSizeColumn i
}
}
BrandedWorksheet v;
v.autoSizeColumns()
यदि मैं autoSizeColumns() नहीं करता हूं तो छवि उचित आकार है।
क्या दोनों के पास कोई तरीका है?
क्या आप शायद पहले कॉलम का आकार नहीं ले सकते हैं, फिर इच्छित आकार में छवि जोड़ें? – Gagravarr
छवि जोड़ने के क्रम को उलट देता है और ऑटोरेसाइज़ का कोई प्रभाव नहीं पड़ता है ... – akaphenom