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

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.

Try ByteScout Spreadsheet SDK today:  60 Day Free Trial (on-premise) or  Web API (on-demand version)

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

Try ByteScout Spreadsheet SDK today:  60 Day Free Trial (on-premise) or  Web API (on-demand version)

VIDEO

ON-PREMISE VERSION INFORMATION

Get 60 Day Free Trial or Visit ByteScout Spreadsheet SDK Home Page

Explore ByteScout Spreadsheet SDK Documentation

Get ByteScout Spreadsheet SDK Free Training

WEB API

Get Your Free API Key

Explore Web API Documentation

Tutorials:

prev
next