Ejemplo n.º 1
0
        public bool Generate <T>(List <T> list, ExtendedGridProperties extendedGridProperties)
        {
            bool isError = false;

            ErrorMessage = string.Empty;

            if (!String.IsNullOrWhiteSpace(extendedGridProperties.CultureName))
            {
                Thread.CurrentThread.CurrentCulture = CultureInfo.CreateSpecificCulture(extendedGridProperties.CultureName);
            }
            if (!String.IsNullOrWhiteSpace(extendedGridProperties.UICultureName))
            {
                Thread.CurrentThread.CurrentUICulture = CultureInfo.CreateSpecificCulture(extendedGridProperties.UICultureName);
            }

            if (ExportStrategy != null)
            {
                if (!ExportStrategy.Export(list, extendedGridProperties))
                {
                    isError      = true;
                    ErrorMessage = "Error occured while generating the excel sheet.";
                }
            }
            else
            {
                ErrorMessage = "Export strategy was not defined.";
            }

            return(isError);
        }
Ejemplo n.º 2
0
        public MemoryStream GenerateExcel(System.Collections.IList list, ExtendedGridProperties extendedGridProperties)
        {
            if (!String.IsNullOrWhiteSpace(extendedGridProperties.CultureName))
            {
                Thread.CurrentThread.CurrentCulture = CultureInfo.CreateSpecificCulture(extendedGridProperties.CultureName);
            }
            if (!String.IsNullOrWhiteSpace(extendedGridProperties.UICultureName))
            {
                Thread.CurrentThread.CurrentUICulture = CultureInfo.CreateSpecificCulture(extendedGridProperties.UICultureName);
            }

            if (ExportStrategy != null)
            {
                return(ExportStrategy.CreateStream(list, extendedGridProperties));
            }
            else
            {
                return(null);
            }
            return(null);
        }