Table of Contents

Getting Started with .NET Core (C# / netcore)

Note

This demo is available in your FlexCel installation at <FlexCel Install Folder>\samples\csharp\VS2022\netcore\10.GettingStarted and also at https:​//​github.​com/​tmssoftware/​TMS-​FlexCel.​NET-​demos/​tree/​master/​csharp/​VS2022/​netcore/​10.​Getting​Started

Overview

In this simple example we just create a basic file. We won't be repeating all the examples here since they are identical to the "Classic" Framework examples.

Just make sure to look at the csharp examples instead.

Files

Program.cs

using FlexCel.Core;
using FlexCel.Render;
using FlexCel.XlsAdapter;
using System;

namespace GettingStarted
{
    class Program
    {
        static void Main(string[] args)
        {
            var xls = new XlsFile(1, TExcelFileFormat.v2019, true);
            xls.SetCellValue(1, 1, "Hello");
            xls.SetCellValue(2, 1, "World");
            xls.SetCellValue(3, 1, new TFormula("=A1 & \" \" & A2"));

            xls.Save("helloworld.xlsx");
            using (FlexCelPdfExport pdf = new FlexCelPdfExport(xls, true))
            {
                pdf.Export("helloworld.pdf");
            }

            Console.WriteLine("All done!");

        }
    }
}