Skip to Content
Odoo Menu
  • Sign in
  • Try it free
  • Apps
    Finance
    • Accounting
    • Invoicing
    • Expenses
    • Spreadsheet (BI)
    • Documents
    • Sign
    Sales
    • CRM
    • Sales
    • POS Shop
    • POS Restaurant
    • Subscriptions
    • Rental
    Websites
    • Website Builder
    • eCommerce
    • Blog
    • Forum
    • Live Chat
    • eLearning
    Supply Chain
    • Inventory
    • Manufacturing
    • PLM
    • Purchase
    • Maintenance
    • Quality
    Human Resources
    • Employees
    • Recruitment
    • Time Off
    • Appraisals
    • Referrals
    • Fleet
    Marketing
    • Social Marketing
    • Email Marketing
    • SMS Marketing
    • Events
    • Marketing Automation
    • Surveys
    Services
    • Project
    • Timesheets
    • Field Service
    • Helpdesk
    • Planning
    • Appointments
    Productivity
    • Discuss
    • Approvals
    • IoT
    • VoIP
    • Knowledge
    • WhatsApp
    Third party apps Odoo Studio Odoo Cloud Platform
  • Industries
    Retail
    • Book Store
    • Clothing Store
    • Furniture Store
    • Grocery Store
    • Hardware Store
    • Toy Store
    Food & Hospitality
    • Bar and Pub
    • Restaurant
    • Fast Food
    • Guest House
    • Beverage Distributor
    • Hotel
    Real Estate
    • Real Estate Agency
    • Architecture Firm
    • Construction
    • Estate Management
    • Gardening
    • Property Owner Association
    Consulting
    • Accounting Firm
    • Odoo Partner
    • Marketing Agency
    • Law firm
    • Talent Acquisition
    • Audit & Certification
    Manufacturing
    • Textile
    • Metal
    • Furnitures
    • Food
    • Brewery
    • Corporate Gifts
    Health & Fitness
    • Sports Club
    • Eyewear Store
    • Fitness Center
    • Wellness Practitioners
    • Pharmacy
    • Hair Salon
    Trades
    • Handyman
    • IT Hardware & Support
    • Solar Energy Systems
    • Shoe Maker
    • Cleaning Services
    • HVAC Services
    Others
    • Nonprofit Organization
    • Environmental Agency
    • Billboard Rental
    • Photography
    • Bike Leasing
    • Software Reseller
    Browse all Industries
  • Community
    Learn
    • Tutorials
    • Documentation
    • Certifications
    • Training
    • Blog
    • Podcast
    Empower Education
    • Education Program
    • Scale Up! Business Game
    • Visit Odoo
    Get the Software
    • Download
    • Compare Editions
    • Releases
    Collaborate
    • Github
    • Forum
    • Events
    • Translations
    • Become a Partner
    • Services for Partners
    • Register your Accounting Firm
    Get Services
    • Find a Partner
    • Find an Accountant
    • Meet an advisor
    • Implementation Services
    • Customer References
    • Support
    • Upgrades
    Github Youtube Twitter Linkedin Instagram Facebook Spotify
    +1 (650) 691-3277
    Get a demo
  • Pricing
  • Help

Odoo is the world's easiest all-in-one management software.
It includes hundreds of business apps:

  • CRM
  • e-Commerce
  • Accounting
  • Inventory
  • PoS
  • Project
  • MRP
All apps
You need to be registered to interact with the community.
All Posts People Badges
Tags (View all)
odoo accounting v14 pos v15
About this forum
You need to be registered to interact with the community.
All Posts People Badges
Tags (View all)
odoo accounting v14 pos v15
About this forum
Help

how to Increase row height in excel report formatting Odoo 13

Subscribe

Get notified when there's activity on this post

This question has been flagged
excelformattingstylesheetrows
2 Replies
4899 Views
Avatar
Farooq Butt

I have to set heading in excel report in odoo 13 but the height of heading and all other rows are same. how to increase row height for heading row using formatting e.g

table_heading_style = xlwt.easyxf(
'font: bold on,height 220;align: wrap on,vert centre, horiz center; align: wrap yes,vert centre, horiz center;pattern: pattern solid, fore-colour aqua;border: left thin,right thin,top thin,bottom thin')


0
Avatar
Discard
Avatar
Midhun M M
Best Answer
Please check 

from odoo import models
from odoo.fields import Date
from datetime import date, datetime
import dateutil.relativedelta

fs = Date.from_string
ts = Date.to_string


class CalibExcelReport(models.AbstractModel):
_name = "report.calibration_tracking.calib_xlsx_document"
_inherit = "report.report_xlsx.abstract"
_description = "Calibration XLSX Report"

def generate_xlsx_report(self, workbook, data, vals):
cell_text_format = workbook.add_format({'align': 'center', 'bold': True, 'font_size': 12, 'bg_color': '#FF9933'})
head = workbook.add_format({'align': 'center', 'bold': True,'size': 14, 'bg_color': '#6B8E23'})
head1 = workbook.add_format({'align': 'left', 'bold': True, 'size': 12, 'bg_color': '#D3D3D3'})
head2 = workbook.add_format({'align': 'left', 'size': 12})
head3 = workbook.add_format({'align': 'left', 'bold': True, 'size': 12})
format1 = workbook.add_format({'align': 'center', 'font_size': 10})
format2 = workbook.add_format({'align': 'center', 'bold': True, 'font_size': 10, 'border': 1, 'bg_color': '#D3D3D3'})
format3 = workbook.add_format({'align': 'center', 'font_size': 10, 'border': 1})
format6 = workbook.add_format({'align': 'center', 'font_size': 10})
worksheet = workbook.add_worksheet('Report')
worksheet.set_column('A:A', 6,)
worksheet.set_column('B:B', 20)
worksheet.set_column('C:C', 20)
worksheet.set_column('D:D', 20)
worksheet.set_column('E:E', 20)
worksheet.set_column('F:F', 20)
worksheet.set_column('G:G', 20)
worksheet.set_column('H:H', 20)
worksheet.set_column('I:I', 20)
worksheet.set_column('J:J', 25)
worksheet.set_column('K:K', 20)
worksheet.set_column('L:L', 20)
row = 2
column = 0

worksheet.merge_range(row, column, row + 1, column + 12, 'Calibration Instrument Master List', head)
row = 5
column = 0

worksheet.write(row, column, 'SL. No', cell_text_format)
worksheet.write(row, column + 1, 'DESCRIPTION', cell_text_format)
worksheet.write(row, column + 2, 'Range', cell_text_format)
worksheet.write(row, column + 3, 'Make', cell_text_format)
worksheet.write(row, column + 4, 'Sl.No', cell_text_format)
worksheet.write(row, column + 5, 'ID NUMBER', cell_text_format)
worksheet.write(row, column + 6, 'CALIBRATED ON', cell_text_format)
worksheet.write(row, column + 7, 'CALIBRATION DUE', cell_text_format)
worksheet.write(row, column + 8, 'LOCATION', cell_text_format)
worksheet.write(row, column + 9, 'TEST CERTIFICATE NO', cell_text_format)
worksheet.write(row, column + 10, 'STATUS/REMARKS', cell_text_format)
worksheet.write(row, column + 11, 'VERIFIED ', cell_text_format)
calibrations = []
if data['date_range_based']:
calibrations = self.env['instrument.calibration'].search([('last_due_date', '>=', data['from_date'])]).filtered(lambda s:s.last_due_date != False and s.last_calib_date != False)
if data['month_based']:
due_date = (date.today() + dateutil.relativedelta.relativedelta(months=int(data['notify_date'])))
calibrations = self.env['instrument.calibration'].search([('last_due_date', '<=', due_date)]).filtered(lambda s:s.last_due_date != False and s.last_calib_date != False)
calib_list = []
if calibrations:
i = 1
for calib in calibrations:
vals = {'no': i,
'desc': calib.product_desc,
'range': calib.range,
'make': calib.instrument_make.name if calib.instrument_make else False,
'sl': calib.sl_no,
'id_no': calib.id_number,
'calib_date': calib.last_calib_date.strftime('%d/%m/%Y') if calib.last_calib_date else False,
'calib_due': calib.last_due_date.strftime('%d/%m/%Y') if calib.last_due_date else False,
'location': calib.location_id.name if calib.location_id else False,
'cert_no': calib.last_certi_no,
'status': calib.status,
'verified': calib.calib_verify}
calib_list.append(vals)
i = i+1
print(calib_list)
row = 6
for ca_list in calib_list:

worksheet.write(row + 1, column + 0, ca_list['no'], format1)
worksheet.write(row + 1, column + 1, ca_list['desc'], format1)
worksheet.write(row + 1, column + 2, ca_list['range'], format1)
worksheet.write(row + 1, column + 3, ca_list['make'], format1)
worksheet.write(row + 1, column + 4, ca_list['sl'], format1)
worksheet.write(row + 1, column + 5, ca_list['id_no'], format1)
worksheet.write(row + 1, column + 6, ca_list['calib_date'], format1)
worksheet.write(row + 1, column + 7, ca_list['calib_due'], format1)
worksheet.write(row + 1, column + 8, ca_list['location'], format1)
worksheet.write(row + 1, column + 9, ca_list['cert_no'], format1)
worksheet.write(row + 1, column + 10, ca_list['status'], format1)
worksheet.write(row + 1, column + 11, ca_list['verified'], format1)
row +=1



0
Avatar
Discard
Avatar
Jitendra Bhatt
Best Answer

Please try below code.

from openpyxl import Workbook

workbook = Workbook(write_only=False)
worksheet = workbook.active
worksheet.row_dimensions[1].height = 70

Please find the more information: https://www.geeksforgeeks.org/python-adjusting-rows-and-columns-of-an-excel-file-using-openpyxl-module/

0
Avatar
Discard
Enjoying the discussion? Don't just read, join in!

Create an account today to enjoy exclusive features and engage with our awesome community!

Sign up
Related Posts Replies Views Activity
Line Spacing in Odoo 17 Solved
formatting
Avatar
Avatar
Avatar
3
Sep 25
3596
Cant download excel data from v11 using chrome anymore Solved
excel
Avatar
Avatar
1
Nov 22
3258
phone formatting feature
formatting
Avatar
Avatar
1
Nov 22
8702
ODOO 12 how can we generate Excel report Solved
excel
Avatar
Avatar
Avatar
Avatar
7
Jan 24
16436
how to write an excel file into a field who is a field.Binary()?
excel
Avatar
0
Feb 17
4119
Community
  • Tutorials
  • Documentation
  • Forum
Open Source
  • Download
  • Github
  • Runbot
  • Translations
Services
  • Odoo.sh Hosting
  • Support
  • Upgrade
  • Custom Developments
  • Education
  • Find an Accountant
  • Find a Partner
  • Become a Partner
About us
  • Our company
  • Brand Assets
  • Contact us
  • Jobs
  • Events
  • Podcast
  • Blog
  • Customers
  • Legal • Privacy
  • Security
الْعَرَبيّة Català 简体中文 繁體中文 (台灣) Čeština Dansk Nederlands English Suomi Français Deutsch हिंदी Bahasa Indonesia Italiano 日本語 한국어 (KR) Lietuvių kalba Język polski Português (BR) română русский язык Slovenský jazyk slovenščina Español (América Latina) Español ภาษาไทย Türkçe українська Tiếng Việt

Odoo is a suite of open source business apps that cover all your company needs: CRM, eCommerce, accounting, inventory, point of sale, project management, etc.

Odoo's unique value proposition is to be at the same time very easy to use and fully integrated.

Website made with

Odoo Experience on YouTube

1. Use the live chat to ask your questions.
2. The operator answers within a few minutes.

Live support on Youtube
Watch now