コード例 #1
0
        public void Write()
        {
            var Value = new List <string[]>();

            foreach (var item in Collection)
            {
                item.Contact.Any(x => !string.IsNullOrEmpty(x.Email));
                foreach (var Contact in item.Contact)
                {
                    if (!string.IsNullOrEmpty(Contact.Email))
                    {
                        var city = string.Empty;
                        foreach (var deco in item.Deco)
                        {
                            city = (deco.StructuredAddress == null) ? "unknown" : deco.StructuredAddress.City;
                            Value.Add(new string[] { Contact.FirstName, Contact.LastName, Contact.TelNo, Contact.CellNo, Contact.Email, string.Join(",", Contact.AdnConfiguration.Types),
                                                     Contact.AdnConfiguration.Email.ToString(), Contact.AdnConfiguration.Sms.ToString(), item.Name, item.Reference, deco.Name, city, item.ClientId });
                        }
                    }
                }
            }
            var newFile = new WriteToExcel();

            newFile.WriteToSheet(Headings, Value);
            newFile.Save(FileName, FileDirectory);
        }
コード例 #2
0
        static void Main(string[] args)
        {
            var headings = new List <string> {
                "Entity Name", "Entity Reference"
            };
            var collection = new List <string[]>()
            {
                new string[] { "Jhon", "sdds621wd" }
            };
            var Amend = new List <string[]>()
            {
                new string[] { "Jane", "fnshbsfkjdf55" }
            };
            var fileDirectory = $"{Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments)}/Temp";
            var fileName      = "ExcelWirteTest";
            var Excel         = new WriteToExcel();

            Excel.WriteToSheet(headings, collection, "Sheet1");
            Excel.Save(fileName, fileDirectory);
            Excel.AmmendToSheet(Amend);
            Excel.Save();
            Excel.ChangeSheet("Nooooo");
            Excel.dispose();
            Console.Read();
        }
コード例 #3
0
        public void Write()
        {
            var newFile = new WriteToExcel();

            newFile.WriteToSheet(Headings, Collection);
            newFile.Save(FileName, Path);
        }