Odoo Help

2

0
1 Answer
3
Avatar

Axel Mendoza Cuba

--Axel Mendoza--
13936
| 8 8 10
Camaguey, Cuba
--Axel Mendoza--

DevOps - Full stack - Software Architect - Developer - Technology Integrator

I could help you to develop anything and solve complex problems based on technologies, integrations and tricky stuffs mostly in Python with OpenERP/Odoo, Zato, Django and many others frameworks programming languages and technologies.

I offers consulting services to anyone with an unanswered questions or needs for customizations. Think about it, maybe it's better to have an expert to solve your issues and projects than having a full-time employee trying to understand what to do and how

Reach me at aekroft@gmail.com

Axel Mendoza Cuba
9/25/15, 8:48 AM

Hi @PujaBaa Zala

From what I know from trying to do the same you have 2 choices here:

1- You could always store the image data in a temp file in order to be used in your xlwt code.

2- You can use openpyxl as the report excel generator, I successfully done what you need only with that library. I used specifically 1.7.0, I don't know if latter versions remove that feature.

==========================================

Example of using openpyxl with an in-memory image data

from openpyxl import Workbook
from openpyxl.writer.excel import ExcelWriter
from openpyxl.drawing import Image

from PIL import Image as PILImage
try:
from cStringIO import StringIO
except ImportError:
from StringIO import StringIO

wb = Workbook()
ws = wb.get_active_sheet()

#extra has the data of the image from the database
im = PILImage.open(StringIO(extra))
img = Image(im)
img.anchor(ws.cell('F1'))
ws.add_image(img)

handler = StringIO()
writer = ExcelWriter(wb)
writer.save(handler)
xls = handler.getvalue()
handler.close()
4 Comments
PujaBaa Zala India
9/26/15, 1:13 AM

Hello @Axel Mendoza , Thanx for suggesting openpyxl ! I've read about Inserting an image using openpyxl, But How can I use it to add image that is stored in database. can you pls help me how to use it?

Axel Mendoza Cuba
9/26/15, 1:48 AM

I edited my answer to include an example

PujaBaa Zala India
9/26/15, 5:59 AM

@Axel Mendoza : thanx a lot. I'll check it

Axel Mendoza Cuba
12/23/15, 2:41 PM

could you accept the answer on the check mark?

Ask a Question
Writer
Keep Informed
2 follower(s)
About This Community

This platform is for beginners and experts willing to share their Odoo knowledge. It's not a forum to discuss ideas, but a knowledge base of questions and their answers.

Register
Odoo Training Center

Access to our E-learning platform and experience all Odoo Apps through learning videos, exercises and Quizz.

Test it now