Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

导出设置ExporterHeader的宽度没有效果 #550

Open
hangyejiadao opened this issue Jan 25, 2024 · 1 comment
Open

导出设置ExporterHeader的宽度没有效果 #550

hangyejiadao opened this issue Jan 25, 2024 · 1 comment

Comments

@hangyejiadao
Copy link

using Magicodes.ExporterAndImporter.Core;
using Magicodes.ExporterAndImporter.Excel;

namespace ConsoleApp1
{
   internal class Program
   {
       static async Task Main(string[] args)
       {
           var _data = new List<Demo>()
           {
               new Demo(){ Id=1,Name="asddfasdfasdfasdfasdfasdfasdff"},

               new Demo(){ Id=2,Name="asdfasdfasdfasdfasdfasdfasdfasdfasfasdfasdfasdfasdfasdfas"},
           };
           var _export = new ExcelExporter();
           var _path = AppDomain.CurrentDomain.BaseDirectory + "/data1.xlsx";
           var result = await _export.Export(_path, _data);
        
           Console.WriteLine("Hello, World!");
       }
   }
   [ExcelExporter(Name = "测试2", TableStyle = OfficeOpenXml.Table.TableStyles.None, AutoFitAllColumn = true, MaxRowNumberOnASheet = 100)]
   public class Demo
   {
       [ExporterHeader(DisplayName = "Id", IsBold = true, Width = 3000)]
       public int Id { get; set; }

       [ExporterHeader(DisplayName = "加粗文本",  WrapText=true, IsBold = true,   Width = 2000)]
       public string Name { get; set; }
   }
}
@Farb
Copy link

Farb commented Jan 25, 2024

@hangyejiadao 得把自适应去掉把。 AutoFitAllColumn = true 改为false

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants