4D Blog

Home Product 4D View Pro : sheet management

4D View Pro : sheet management

July 21, 2021

Product

Sometimes, you need to display different tables of information in one document. For better visibility, it’s often necessary to display them in different sheets. In this case, you need to create, rename, hide or remove a sheet, or simply know which sheet the user is currently on.

With 4D v19 R2, you can manage the sheets in your 4D View Pro documents by programming.

By default, a new document only has one sheet:

    

Adding Worksheets

There are two ways to create new worksheets:

  • with the VP SET SHEET COUNT command, you can define at once the number of sheets you need. For example, if you need three sheets:

VP SET SHEET COUNT("ViewProArea"; 3)

blank

Each sheet has an index that you can use in the commands. Indexing starts at 0, so here the index of “Sheet1” is 0, the index of “Sheet2” is 1, and so on… Keep in mind that the index is the sheet position in the tab bar, and it changes when you add, remove or change the order of your sheets.

  • with the VP ADD SHEET command, you can insert a sheet with a custom name at a specific index. For example, if you need to insert a new sheet with the name  “Total first quarter”:

VP ADD SHEET("ViewProArea"; 0; "Total first quarter")blankBecause we have inserted a new sheet, the indexes have changed. The index of “Total first quarter” is 0, the index of “Sheet1” is now 1, and so on…

reNaming a Worksheet

By default, the sheets in a View Pro document are named “SheetX”. To give them names that are more relevant for your users, use the VP SET SHEET NAME command. In our example, we can change the names “Sheet1″,”Sheet2″,”Sheet3” to “January”, “February” and “March”:

VP SET SHEET NAME("ViewProArea"; "January"; 1)
VP SET SHEET NAME("ViewProArea"; "February"; 2)
VP SET SHEET NAME("ViewProArea"; "March"; 3)

blank

selectING a worksheet

You can change the sheet selected with VP SET CURRENT SHEET. For example, if we add a new worksheet and select it:

// find the last position by counting the sheets
$lastPosition:=VP Get sheet count("ViewProArea")
// add new sheet at the last position
VP ADD SHEET("ViewProArea"; $lastPosition; "Total second quarter")
// select the new sheet
VP SET CURRENT SHEET("ViewProArea"; $lastPosition)

blank

Hiding a Worksheet

If you need to hide a sheet because it contains only information for calculation, use VP SET SHEET OPTIONS. In our example, if we want to show only the “Total X quarter” sheets, and use the others only for calculations:

$options:=New object
$options.visible:=False
VP SET SHEET OPTIONS("ViewProArea"; $options; 1)
VP SET SHEET OPTIONS("ViewProArea"; $options; 2)
VP SET SHEET OPTIONS("ViewProArea"; $options; 3)

blank

And check out the doc center for more details!

Discuss

Tags 4D View Pro, Spreadsheet, v19 R2, v20, Workbook

Latest related posts

  • December 3, 2025

    Give AI to a 30 years old 4D application

  • November 28, 2025

    ORDA – Handle an event-driven logic during database operations

  • November 27, 2025

    ORDA – Permissions – Restrict / allow web access to the resources in one click

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

  • AI
  • 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 AIKit 4D for Android 4D for iOS 4D NetKit 4D Qodly Pro 4D View Pro 4D Write Pro 20 R10 21 Administration AI Artificial Intelligence Build application CI/CD Class Client/Server Code editor Collections Formula Listbox Logs Mail Microsoft 365 Network Objects OpenAI ORDA PDF Pictures Preemptive Programming REST Scalability Security Session Source control Speed Spreadsheet Tutorial UI User Experience v20 vscode Web Word processor

Tags

4D AIKit 4D for Android 4D for iOS 4D NetKit 4D Qodly Pro 4D View Pro 4D Write Pro 20 R10 21 Administration AI Artificial Intelligence Build application CI/CD Class Client/Server Code editor Collections Formula Listbox Logs Mail Microsoft 365 Network Objects OpenAI ORDA PDF Pictures Preemptive Programming 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