public static XtraReport CreateQueryReport(QueryRegionSummaryModel model)
 {
     var regions = model.RegionList;
     var queries = model.QueryList;
     var year = model.Year;
     var form = model.Form;
     var reportDataList = new QueryReportDataCollection();
     using (var spreadsheetControl = new SpreadsheetControl() { AllowDrop = false })
     {
         foreach (var region in regions)
         {
             var formData = region.region_form_data.FirstOrDefault(t => t.form == form && t.send_date.Year == year);
             if (formData != null)
             {
                 var excelData = formData.file.contents;
                 var format = formData.document_format.IsOpenXml()
                     ? DocumentFormat.OpenXml
                     : DocumentFormat.Xls;
                 spreadsheetControl.LoadDocument(excelData, format);
             }
             foreach (var query in queries)
             {
                 var stringValue = "";
                 try
                 {
                     var content = query.content;
                     if (content.StartsWith("@"))
                     {
                         var propName = content.Substring(1);
                         var propInfo = typeof(region).GetProperty(propName);
                         var value = propInfo.GetValue(region);
                         var valueType = value.GetType();
                         if (valueType.GetInterface("System.Collections.IEnumerable") != null && valueType != typeof(String))
                         {
                             var collection = (IEnumerable<object>)value;
                             stringValue = collection.Join(", ");
                         }
                         else if (valueType == typeof(bool))
                         {
                             stringValue = (bool)value ? "Да" : "Нет";
                         }
                         else
                         {
                             stringValue = value.ToString();
                         }
                     }
                     else
                     {
                         var value = spreadsheetControl.Document.Range[content].Value;
                         stringValue = GetStringValueFromCell(value);
                     }
                 }
                 catch (Exception ex)
                 {
                     stringValue = "Не удалось";
                 }
                 reportDataList.Add(new QueryReportRegionData(region, query, stringValue));
             }
         }
     }
     var groupedList = reportDataList.Group().ToList();
     var report = new QueryReport { ReportData = groupedList };
     Reports.Add(report);
     return report;
 }
 public static Task<XtraReport> CreateQueryReportAsync(QueryRegionSummaryModel model)
 {
     return Task.Run(() => CreateQueryReport(model));
 }