Thứ Ba, 21 tháng 11, 2017

How to read theme data of an excel file

//your excel file path
string filepath = @"C:\Users\xxx\Desktop\xxx.xlsx";
//an excel file is just a zip file
using (var zip = System.IO.Compression.ZipFile.OpenRead(filepath))
using (var stream = zip.GetEntry("xl/theme/theme1.xml").Open())
using (var rd = new StreamReader(stream))
{
 var xml = rd.ReadToEnd();
}