ByteScout Spreadsheet SDK - VB.NET - Set Date Formatting in Cells - ByteScout
Announcement
Our ByteScout SDK products are sunsetting as we focus on expanding new solutions.
Learn More Open modal
Close modal
Announcement Important Update
ByteScout SDK Sunsetting Notice
Our ByteScout SDK products are sunsetting as we focus on our new & improved solutions. Thank you for being part of our journey, and we look forward to supporting you in this next chapter!

ByteScout Spreadsheet SDK – VB.NET – Set Date Formatting in Cells

  • Home
  • /
  • Articles
  • /
  • ByteScout Spreadsheet SDK – VB.NET – Set Date Formatting in Cells

How to set date formatting in cells in VB.NET with ByteScout Spreadsheet SDK

Write code in VB.NET to set date formatting in cells with this step-by-step tutorial

Set date formatting in cells is easy to implement in VB.NET if you use these source codes below. ByteScout Spreadsheet SDK can set date formatting in cells. It can be used from VB.NET. ByteScout Spreadsheet SDK is the SDK component for writing, reading, modifying and calculating Excel and CSV spreadsheets. Can calculate and reculculate formulas with Excel installed. You may import or export data to and from CSV, XML, JSON. Supports export to databases, arrays, streams.

Fast application programming interfaces of ByteScout Spreadsheet SDK for VB.NET plus the instruction and the code below will help you quickly learn how to set date formatting in cells. In order to implement the functionality, you should copy and paste this code for VB.NET below into your code editor with your app, compile and run your application. You can use these VB.NET sample examples in one or many applications.

Trial version of ByteScout Spreadsheet SDK is available for free. Source code samples are included to help you with your VB.NET app.

On-demand (REST Web API) version:
 Web API (on-demand version)

On-premise offline SDK for Windows:
 60 Day Free Trial (on-premise)

Module1.vb
      
Imports Bytescout.Spreadsheet Imports System.IO Imports System.Diagnostics Module Module1 Sub Main() ' Create new Spreadsheet Dim document As New Spreadsheet() ' Get worksheet by name Dim worksheet As Worksheet = document.Workbook.Worksheets.Add("Sample") ' Set captions worksheet.Cell(0, 0).Value = "#" worksheet.Cell(0, 1).Value = "Date" For i As Integer = 1 To 7 ' Set number worksheet.Cell(i, 0).Value = i ' Set current cell Dim currentCell As Cell = worksheet.Cell(i, 1) ' Set date to the current date time currentCell.ValueAsDateTime = DateTime.Now ' Set date format currentCell.NumberFormatString = "dd.mm.yyyy" Next ' remove output file if already exists If File.Exists("Output.xls") Then File.Delete("Output.xls") End If ' Save document document.SaveAs("Output.xls") ' Close Spreadsheet document.Close() ' open in default spreadsheets viewer/editor Process.Start("Output.xls") End Sub End Module

ON-PREMISE OFFLINE SDK

60 Day Free Trial or Visit ByteScout Spreadsheet SDK Home Page

Explore ByteScout Spreadsheet SDK Documentation

Explore Samples

Sign Up for ByteScout Spreadsheet SDK Online Training

ON-DEMAND REST WEB API

Get Your API Key

Explore Web API Docs

Explore Web API Samples

VIDEO

ON-PREMISE OFFLINE SDK

60 Day Free Trial or Visit ByteScout Spreadsheet SDK Home Page

Explore ByteScout Spreadsheet SDK Documentation

Explore Samples

Sign Up for ByteScout Spreadsheet SDK Online Training

ON-DEMAND REST WEB API

Get Your API Key

Explore Web API Docs

Explore Web API Samples

Tutorials:

prev
next