using System;
using NPOI.HSSF.UserModel;
using NPOI.SS.UserModel;
using System.IO;
namespace exportExcel
{
class program
{
static void Main()
{
TaxCal tc = new TaxCal(5000);
tc.Print();
tc.ExportExcel();
}
}
class TaxCal
{
public TaxCal(double bill)
{
Bill = bill;
}
const double RATE = 0.18;
public double Bill { get; private set; }
public double Tip { get { return Bill * RATE; } }
public void Print()
{
Console.WriteLine();
Console.WriteLine($"账单总额:{Bill,10:c}");
Console.WriteLine($"小费数额:{Tip,10:c}({RATE:p1})");
Console.WriteLine("".PadRight(44, '-'));
Console.WriteLine($"账单实付:{Bill + Tip,10:c}");
}
public void ExportExcel()
{
var fileName =
c#控制台数据导出excel文件 (1)
于 2021-04-15 16:06:45 首次发布
![](https://img-home.csdnimg.cn/images/20240711042549.png)