简体   繁体   English

使用Aspose读取Excel模板

[英]Read Excel template using Aspose

Let's say I have a class called User: 假设我有一个名为User的类:

public class User
{
        public int ID { get; set; }
        public string Name { get; set; }
        public string Email { get; set; }
        public int? Age { get; set; }
}

And an Excel sheet where the 1st column is ID, 2nd is Name, 3rd is Email and 4th is Age 还有一个Excel工作表,其中第一列是ID,第二列是Name,第三列是Email,第四列是Age

Is there a way I can tell Aspose to use this template and populate a list of type User based on this Excel template so then I can save it to a database? 有没有一种方法可以告诉Aspose使用此模板并根据此Excel模板填充User类型的列表,然后将其保存到数据库中?

If you need to import data from a collection of custom objects to a worksheet, you may try to use Cells.ImportCustomObjects method provided by Aspose.Cells APIs. 如果需要将自定义对象的集合中的数据导入到工作表中,则可以尝试使用Aspose.Cells API提供的Cells.ImportCustomObjects方法。 You will provide a list of columns/properties to the method to display your desired list of objects in the worksheet accordingly, see the topic here for your reference. 您将为该方法提供列/属性列表,以在工作表中相应地显示所需的对象列表,请参阅此处的主题以供参考。

I am working as Support developer/ Evangelist at Aspose. 我在Aspose担任技术支持/开发人员。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM