4D Blog

Home Product 4D View Pro: Customize the Style of your Tables

4D View Pro: Customize the Style of your Tables

January 17, 2023

Product

Tables are an integral part of 4D View Pro documents, so we have provided many table-related features over the releases of 4D. 4D v19 R8 adds a new one related to styles so that the table fits perfectly with the rest of your document.

From now on, the VP Set table theme provides a way to apply by programming one of the predefined table styles. If none of these styles meet your need, you can define your own theme and apply it to your table.

HDI VP Table Style

SpreadJS has over 60 predefined themes:

  • “dark1” to “dark11”
  • “light1” to “light21”
  • “medium1” to “medium28”
  • “professional1” to “professional24”

To create a table with one of these themes, you can indicate it in the VP CREATE TABLE command:

$parameter:=New object
$parameter.theme:="dark10"
VP CREATE TABLE(VP Cells("ViewProArea"; 2; 1; 3; 1); "myTable"; "people"; $parameter)

In the same way, you can modify the theme of an existing table with VP SET TABLE THEME:

$parameter:=cs.ViewPro.TableThemeOptions
$parameter.theme:="medium2"
VP SET TABLE THEME("ViewProArea"; "myTable"; $parameter)

blank

You can retrieve and test the dark, light, and medium themes using the Ribbon:

blank

Create a customized theme

If none of the defined themes suit your needs, you can create your theme yourself. You can define a style for your columns, rows, header, and footer.

For example, if you want to have this banded column rendering:

blank

You need to:

  • Activate the band column rendering:
$param:=cs.ViewPro.TableThemeOptions
$param.bandColumns:=True
$param.bandRows:=False
  • Create your header style:
$styleHeader:=cs.ViewPro.TableStyle.new()
$styleHeader.backColor:="rgb(255,228,92)"
$styleHeader.foreColor:="rgb(3,4,94)"
$param.theme:=cs.ViewPro.TableTheme.new()
$param.theme.headerRowStyle:=$styleHeader
  • Create your alternate columns style:
$styleColumn1:=cs.ViewPro.TableStyle.new()
$styleColumn1.backColor:="#0077B6"
$styleColumn1.foreColor:="#03045E"
$param.theme.firstColumnStripStyle:=$styleColumn1

$styleColumn2:=cs.ViewPro.TableStyle.new()
$styleColumn2.backColor:="#CAF0F8"
$styleColumn2.foreColor:="#03045E"
$param.theme.secondColumnStripStyle:=$styleColumn2

Apply your new theme thanks to the VP SET TABLE NAME:

VP SET TABLE THEME("ViewProArea"; "myTable"; $param)

And it’s done!

Check out this feature with the HDI and the documentation for more details!

Discuss

Tags 4D View Pro, Data table, Spreadsheet, v19 R8, v20

Latest related posts

  • May 20, 2025

    Automatic Refresh of OEM Build Licenses

  • May 16, 2025

    New class to handle incoming TCP connections

  • April 29, 2025

    Discover your AI-powered writing assistant in 4D Write Pro

Fabrice Mainguené
Fabrice Mainguené
• Product Owner •Fabrice Mainguené joined 4D Program team in November, 2016. As a Product Owner, he is in charge of writing the user stories then translating it to functional specifications. His role is also to make sure that the feature implementation delivered is meeting the customer need.After obtaining a Bachelor degree in Computer Science at CNAM, Fabrice joined a small software publishing company as a Windev developer. Then he worked for different companies in industry and trade areas as a Windev and web developer as well as technical advisor on new features.
  • Deutsch
  • Français
  • English
  • Português
  • Čeština
  • Español
  • Italiano
  • 日本語

Categories

Browse categories

  • 4D View Pro
  • 4D Write Pro
  • 4D for Mobile
  • Email
  • Development Mode
  • 4D Language
  • ORDA
  • User Interface / GUI
  • Qodly Studio
  • Server
  • Maintenance
  • Deployment
  • 4D Tutorials
  • Generic
  • 4D Summit sessions and other online videos

Tags

4D-Analyzer 4D for Android 4D for iOS 4D NetKit 4D Qodly Pro 4D View Pro 4D Write Pro 20 R8 20 R9 Administration Authentication Build application CI/CD Class Client/Server Code editor Collections Compatibility settings Formula Listbox Logs Mail Microsoft 365 Network Objects ORDA PDF Pictures Preemptive Programming Qodly Studio REST Scalability Security Session Source control Speed Spreadsheet Tutorial UI User Experience v20 vscode Web Word processor

Tags

4D-Analyzer 4D for Android 4D for iOS 4D NetKit 4D Qodly Pro 4D View Pro 4D Write Pro 20 R8 20 R9 Administration Authentication Build application CI/CD Class Client/Server Code editor Collections Compatibility settings Formula Listbox Logs Mail Microsoft 365 Network Objects ORDA PDF Pictures Preemptive Programming Qodly Studio REST Scalability Security Session Source control Speed Spreadsheet Tutorial UI User Experience v20 vscode Web Word processor
Subscribe to 4D Newsletter

© 2025 4D SAS - All rights reserved
Terms & Conditions | Legal Notices | Data Policy | Cookie Policy | Contact us | Write for us


Subscribe to 4D Newsletter

* Your privacy is very important to us. Please click here to view our Policy

Contact us

Got a question, suggestion or just want to get in touch with the 4D bloggers? Drop us a line!

* Your privacy is very important to us. Please click here to view our Policy