internal void ReadImage(IExcelGenerator excel, RPLImageData image, string imageName, RPLReport report)
 {
     if (excel == null || image == null || report == null || imageName == null)
     {
         return;
     }
     SetMimeType(image.ImageMimeType);
     m_imageName = imageName;
     if (image.ImageData != null)
     {
         m_imageData = excel.CreateStream(imageName);
         m_imageData.Write(image.ImageData, 0, image.ImageData.Length);
     }
     else
     {
         if (image.ImageDataOffset <= 0)
         {
             m_imageData     = null;
             image.ImageData = null;
             return;
         }
         m_imageData = excel.CreateStream(imageName);
         report.GetImage(image.ImageDataOffset, m_imageData);
     }
     image.ImageData = null;
     if (image.GDIImageProps != null)
     {
         m_width                = image.GDIImageProps.Width;
         m_height               = image.GDIImageProps.Height;
         m_verticalResolution   = image.GDIImageProps.VerticalResolution;
         m_horizontalResolution = image.GDIImageProps.HorizontalResolution;
         m_imageFormat          = image.GDIImageProps.RawFormat;
     }
 }
Пример #2
0
        public Stream Generate(string data, string configuration)
        {
            var             excelGeneratorHandle = Activator.CreateInstanceFrom(assemblyName, className);
            IExcelGenerator excelGenerator       = excelGeneratorHandle.Unwrap() as IExcelGenerator;

            return(excelGenerator.Generate(data, configuration));
        }
Пример #3
0
        private static BorderProperties FillBorderProperties(IExcelGenerator excel, BorderProperties currBorder, BorderProperties border, ExcelBorderPart part, object style, object width, object color)
        {
            BorderProperties borderProperties = currBorder;

            if (style != null)
            {
                if (borderProperties == null)
                {
                    borderProperties = new BorderProperties(border, part);
                }
                borderProperties.Style = LayoutConvert.ToBorderLineStyle((RPLFormat.BorderStyles)style);
            }
            if (width != null)
            {
                if (borderProperties == null)
                {
                    borderProperties = new BorderProperties(border, part);
                }
                borderProperties.Width = LayoutConvert.ToPoints((string)width);
            }
            if (color != null && !color.Equals("Transparent"))
            {
                if (borderProperties == null)
                {
                    borderProperties = new BorderProperties(border, part);
                }
                borderProperties.Color = excel.AddColor((string)color);
            }
            return(borderProperties);
        }
Пример #4
0
        internal void RenderBorders(IExcelGenerator excel)
        {
            IStyle cellStyle = excel.GetCellStyle();

            if (m_backgroundColor != null)
            {
                cellStyle.BackgroundColor = m_backgroundColor;
            }
            if (m_diagonal != null)
            {
                m_diagonal.Render(cellStyle);
            }
            if (m_topBorder != null && !m_omitBorderTop)
            {
                m_topBorder.Render(cellStyle);
            }
            if (m_bottomBorder != null && !m_omitBorderBottom)
            {
                m_bottomBorder.Render(cellStyle);
            }
            if (m_leftBorder != null)
            {
                m_leftBorder.Render(cellStyle);
            }
            if (m_rightBorder != null)
            {
                m_rightBorder.Render(cellStyle);
            }
        }
 public DeclarationListModel(IApiHttpClient apiHttpClient, IErrorHandler errorHandler, IStringLocalizer <DeclarationListModel> localizer, IExcelGenerator excelGenerator)
 {
     this.apiHttpClient  = apiHttpClient;
     this.errorHandler   = errorHandler;
     this.localizer      = localizer;
     this.excelGenerator = excelGenerator;
 }
        public void ReadImage(IExcelGenerator excel, RPLImageData image, string imageName, RPLReport report)
        {
            if (excel != null && image != null && report != null && imageName != null)
            {
                this.SetMimeType(image.ImageMimeType);
                this.m_imageName = imageName;
                if (image.ImageData != null)
                {
                    this.m_imageData = excel.CreateStream(imageName);
                    this.m_imageData.Write(image.ImageData, 0, image.ImageData.Length);
                    goto IL_008d;
                }
                if (image.ImageDataOffset > 0)
                {
                    this.m_imageData = excel.CreateStream(imageName);
                    report.GetImage(image.ImageDataOffset, this.m_imageData);
                    goto IL_008d;
                }
                this.m_imageData = null;
                image.ImageData  = null;
            }
            return;

IL_008d:
            image.ImageData = null;
            if (image.GDIImageProps != null)
            {
                this.m_width                = image.GDIImageProps.Width;
                this.m_height               = image.GDIImageProps.Height;
                this.m_verticalResolution   = image.GDIImageProps.VerticalResolution;
                this.m_horizontalResolution = image.GDIImageProps.HorizontalResolution;
                this.m_imageFormat          = image.GDIImageProps.RawFormat;
            }
        }
Пример #7
0
        private static void FillLeftBorderProperties(RPLStyleProps style, IExcelGenerator excel, ref BorderProperties leftBorder)
        {
            BorderProperties currBorder = FillBorderProperties(excel, null, leftBorder, ExcelBorderPart.Left, style[5], style[10], style[0]);

            currBorder = FillBorderProperties(excel, currBorder, leftBorder, ExcelBorderPart.Left, style[6], style[11], style[1]);
            if (currBorder != null)
            {
                leftBorder = currBorder;
            }
        }
Пример #8
0
        private static void FillRightBorderProperties(RPLStyleProps style, IExcelGenerator excel, ref BorderProperties rightBorder)
        {
            BorderProperties currBorder = FillBorderProperties(excel, null, rightBorder, ExcelBorderPart.Right, style[5], style[10], style[0]);

            currBorder = FillBorderProperties(excel, currBorder, rightBorder, ExcelBorderPart.Right, style[7], style[12], style[2]);
            if (currBorder != null)
            {
                rightBorder = currBorder;
            }
        }
Пример #9
0
        private static void FillTopBorderProperties(RPLStyleProps style, IExcelGenerator excel, ref BorderProperties topBorder)
        {
            BorderProperties currBorder = FillBorderProperties(excel, null, topBorder, ExcelBorderPart.Top, style[5], style[10], style[0]);

            currBorder = FillBorderProperties(excel, currBorder, topBorder, ExcelBorderPart.Top, style[8], style[13], style[3]);
            if (currBorder != null)
            {
                topBorder = currBorder;
            }
        }
Пример #10
0
        private static void FillBottomBorderProperties(RPLStyleProps style, IExcelGenerator excel, ref BorderProperties bottomBorder)
        {
            BorderProperties currBorder = FillBorderProperties(excel, null, bottomBorder, ExcelBorderPart.Bottom, style[5], style[10], style[0]);

            currBorder = FillBorderProperties(excel, currBorder, bottomBorder, ExcelBorderPart.Bottom, style[9], style[14], style[4]);
            if (currBorder != null)
            {
                bottomBorder = currBorder;
            }
        }
Пример #11
0
 public PlayedGamesController(
     IPlayedGameRetriever playedGameRetriever,
     IExcelGenerator excelGenerator,
     IPlayedGameCreator playedGameCreator,
     IPlayedGameDeleter playedGameDeleter)
 {
     this.playedGameRetriever = playedGameRetriever;
     this.excelGenerator      = excelGenerator;
     this.playedGameCreator   = playedGameCreator;
     this.playedGameDeleter   = playedGameDeleter;
 }
Пример #12
0
 public PlayedGamesController(
     IPlayedGameRetriever playedGameRetriever, 
     IExcelGenerator excelGenerator, 
     IPlayedGameSaver playedGameSaver, 
     IPlayedGameDeleter playedGameDeleter, ITransformer transformer)
 {
     this.playedGameRetriever = playedGameRetriever;
     this.excelGenerator = excelGenerator;
     this.playedGameSaver = playedGameSaver;
     this.playedGameDeleter = playedGameDeleter;
     this.transformer = transformer;
 }
Пример #13
0
 public PlayedGamesController(
     IPlayedGameRetriever playedGameRetriever,
     IExcelGenerator excelGenerator,
     IPlayedGameSaver playedGameSaver,
     IPlayedGameDeleter playedGameDeleter, ITransformer transformer)
 {
     this.playedGameRetriever = playedGameRetriever;
     this.excelGenerator      = excelGenerator;
     this.playedGameSaver     = playedGameSaver;
     this.playedGameDeleter   = playedGameDeleter;
     this.transformer         = transformer;
 }
Пример #14
0
 public PlayedGamesController(
     IPlayedGameRetriever playedGameRetriever,
     IExcelGenerator excelGenerator,
     IPlayedGameSaver playedGameSaver,
     IPlayedGameDeleter playedGameDeleter, ITransformer transformer,
     ICreatePlayedGameComponent createPlayedGameComponent)
 {
     _playedGameRetriever       = playedGameRetriever;
     _excelGenerator            = excelGenerator;
     _playedGameSaver           = playedGameSaver;
     _playedGameDeleter         = playedGameDeleter;
     _transformer               = transformer;
     _createPlayedGameComponent = createPlayedGameComponent;
 }
Пример #15
0
 public ExcelController(
     IExcelGenerator <BaseApplicationExcelRow> generator,
     IForwarderRepository forwarders,
     ICarrierRepository carriers,
     ISenderRepository senders,
     IApplicationExcelRowSource rowSource,
     IIdentityService identity)
 {
     _generator  = generator;
     _forwarders = forwarders;
     _carriers   = carriers;
     _senders    = senders;
     _rowSource  = rowSource;
     _identity   = identity;
 }
Пример #16
0
		public ExcelController(
			IExcelGenerator<BaseApplicationExcelRow> generator,
			IForwarderRepository forwarders,
			ICarrierRepository carriers,
			ISenderRepository senders,
			IApplicationExcelRowSource rowSource,
			IIdentityService identity)
		{
			_generator = generator;
			_forwarders = forwarders;
			_carriers = carriers;
			_senders = senders;
			_rowSource = rowSource;
			_identity = identity;
		}
Пример #17
0
 private void FillBorderProperties(IExcelGenerator excel, BorderProperties border, object style, object width, object color)
 {
     if (style != null)
     {
         border.Style = LayoutConvert.ToBorderLineStyle((RPLFormat.BorderStyles)style);
     }
     if (width != null)
     {
         border.Width = LayoutConvert.ToPoints((string)width);
     }
     if (color != null && !color.Equals("Transparent"))
     {
         border.Color = excel.AddColor((string)color);
     }
 }
Пример #18
0
        private string RenderString(List <ReportItemInfo> list, IExcelGenerator excel)
        {
            StringBuilder            stringBuilder            = new StringBuilder();
            HeaderFooterRichTextInfo headerFooterRichTextInfo = null;
            double num  = 0.0;
            string text = string.Empty;
            bool   flag = false;

            foreach (ReportItemInfo item in list)
            {
                if (stringBuilder.Length > 0 && !stringBuilder[stringBuilder.Length - 1].Equals("\n"))
                {
                    stringBuilder.Append("\n");
                }
                RPLTextBoxPropsDef rPLTextBoxPropsDef = item.Values.Definition as RPLTextBoxPropsDef;
                if (rPLTextBoxPropsDef.IsSimple)
                {
                    if (flag)
                    {
                        headerFooterRichTextInfo.CompleteCurrentFormatting();
                    }
                    excel.BuildHeaderFooterString(stringBuilder, item.Values, ref text, ref num);
                    flag = false;
                }
                else
                {
                    flag = true;
                    RPLTextBox rPLTextBox = (RPLTextBox)item.RPLSource;
                    if (headerFooterRichTextInfo == null)
                    {
                        headerFooterRichTextInfo = new HeaderFooterRichTextInfo(stringBuilder);
                    }
                    HorizontalAlignment horizontalAlignment = HorizontalAlignment.General;
                    bool   renderListPrefixes = true;
                    object obj = rPLTextBox.ElementProps.Style[29];
                    if (obj != null)
                    {
                        renderListPrefixes = ((RPLFormat.Directions)obj == RPLFormat.Directions.LTR);
                    }
                    LayoutEngine.RenderRichText(null, rPLTextBox, headerFooterRichTextInfo, true, null, renderListPrefixes, ref horizontalAlignment);
                    num  = headerFooterRichTextInfo.LastFontSize;
                    text = headerFooterRichTextInfo.LastFontName;
                    headerFooterRichTextInfo.CompleteRun();
                }
            }
            return(stringBuilder.ToString(0, Math.Min(stringBuilder.Length, 256)));
        }
 public RegistrationController(
     IFormHandlerFactory formHandlerFactory,
     IRegistrationService registrationService,
     IMapper mapper,
     IEmployeeService employeeService,
     IAuthorizationService authorizationService,
     ITimeService timeService,
     IRegistrationsViewModelService registrationsViewModelService,
     IRazorHtmlLayoutGenerator htmlLayoutGenerator,
     IPdfGenerator pdfGenerator,
     IExcelGenerator excelGenerator)
     : base(
         formHandlerFactory,
         authorizationService)
 {
     _registrationService = registrationService;
     _mapper          = mapper;
     _employeeService = employeeService;
     _timeService     = timeService;
     _registrationsViewModelService = registrationsViewModelService;
     _htmlLayoutGenerator           = htmlLayoutGenerator;
     _pdfGenerator   = pdfGenerator;
     _excelGenerator = excelGenerator;
 }
Пример #20
0
 internal BorderInfo(RPLElementStyle style, int width, int height, bool slant, bool omitBorderTop, bool omitBorderBottom, bool defaultLine, IExcelGenerator excel)
 {
     m_omitBorderTop    = omitBorderTop;
     m_omitBorderBottom = omitBorderBottom;
     if (height == 0)
     {
         if (defaultLine)
         {
             m_topBorder = new BorderProperties(ExcelBorderPart.Top);
             FillBorderProperties(excel, m_topBorder, style[5], style[10], style[0]);
         }
         else
         {
             m_bottomBorder = new BorderProperties(ExcelBorderPart.Bottom);
             FillBorderProperties(excel, m_bottomBorder, style[5], style[10], style[0]);
         }
     }
     else if (width == 0)
     {
         m_leftBorder = new BorderProperties(ExcelBorderPart.Left);
         FillBorderProperties(excel, m_leftBorder, style[5], style[10], style[0]);
     }
     else if (slant)
     {
         m_diagonal = new BorderProperties(ExcelBorderPart.DiagonalUp);
         FillBorderProperties(excel, m_diagonal, style[5], style[10], style[0]);
     }
     else
     {
         m_diagonal = new BorderProperties(ExcelBorderPart.DiagonalDown);
         FillBorderProperties(excel, m_diagonal, style[5], style[10], style[0]);
     }
 }
Пример #21
0
 internal BorderInfo(RPLStyleProps style, bool omitBorderTop, bool omitBorderBottom, IExcelGenerator excel)
 {
     m_omitBorderTop    = omitBorderTop;
     m_omitBorderBottom = omitBorderBottom;
     FillAllBorders(style, ref m_leftBorder, ref m_rightBorder, ref m_topBorder, ref m_bottomBorder, ref m_backgroundColor, excel);
 }
 public ExcelDataPopulater_Test()
 {
     excelGenerator = new ExcelGenerator("test.xlsx", "uiSheet", "dataSheet");
 }
Пример #23
0
 public ExcelController(IExcelGenerator excelGenerator)
 {
     _excelGenerator = excelGenerator;
 }
 public ExcelGeneratorQueryHandler()
 {
     _excelGenerator = new ExcelGenerator();
 }
 public DeclarationFormModel(IApiHttpClient apiHttpClient, IErrorHandler errorHandler, IExcelGenerator excelGenerator)
 {
     this.apiHttpClient  = apiHttpClient;
     this.errorHandler   = errorHandler;
     this.excelGenerator = excelGenerator;
 }
Пример #26
0
 internal static void FillAllBorders(RPLStyleProps style, ref BorderProperties leftBorder, ref BorderProperties rightBorder, ref BorderProperties topBorder, ref BorderProperties bottomBorder, ref IColor backgroundColor, IExcelGenerator excel)
 {
     if (style[34] != null && !style[34].Equals("Transparent"))
     {
         backgroundColor = excel.AddColor((string)style[34]);
     }
     FillLeftBorderProperties(style, excel, ref leftBorder);
     FillRightBorderProperties(style, excel, ref rightBorder);
     FillTopBorderProperties(style, excel, ref topBorder);
     FillBottomBorderProperties(style, excel, ref bottomBorder);
 }
Пример #27
0
 public ReportController(IExcelGenerator excelGenerator)
 {
     _excelGenerator = excelGenerator;
 }
Пример #28
0
        internal void RenderStrings(RPLReport report, IExcelGenerator excel, out string left, out string center, out string right)
        {
            foreach (ReportItemInfo full in m_fullList)
            {
                RPLPageLayout rPLPageLayout = full.RPLSource as RPLPageLayout;
                if (rPLPageLayout != null)
                {
                    continue;
                }
                RPLTextBox   rPLTextBox = full.RPLSource as RPLTextBox;
                RPLItemProps rPLItemProps;
                byte         elementType;
                if (rPLTextBox != null)
                {
                    if (rPLTextBox.StartOffset > 0)
                    {
                        rPLItemProps = m_report.GetItemProps(rPLTextBox.StartOffset, out elementType);
                    }
                    else
                    {
                        rPLItemProps = (RPLItemProps)rPLTextBox.ElementProps;
                        elementType  = 7;
                    }
                }
                else
                {
                    rPLItemProps = m_report.GetItemProps(full.RPLSource, out elementType);
                }
                if (elementType == 7)
                {
                    full.Values = (RPLTextBoxProps)rPLItemProps;
                    RPLElementStyle     style = rPLItemProps.Style;
                    HorizontalAlignment horizontalAlignment = HorizontalAlignment.Left;
                    object obj = style[25];
                    if (obj != null)
                    {
                        horizontalAlignment = LayoutConvert.ToHorizontalAlignEnum((RPLFormat.TextAlignments)obj);
                    }
                    int    num   = 0;
                    int    num2  = 0;
                    string text  = (string)rPLItemProps.Style[15];
                    string text2 = (string)rPLItemProps.Style[16];
                    if (text != null)
                    {
                        num = LayoutConvert.ConvertMMTo20thPoints(LayoutConvert.ToMillimeters(text));
                    }
                    if (text2 != null)
                    {
                        num2 = LayoutConvert.ConvertMMTo20thPoints(LayoutConvert.ToMillimeters(text2));
                    }
                    switch (horizontalAlignment)
                    {
                    case HorizontalAlignment.Left:
                        full.AlignmentPoint = full.Left + num;
                        break;

                    case HorizontalAlignment.Right:
                        full.AlignmentPoint = full.Right - num2;
                        break;

                    default:
                        full.AlignmentPoint = full.Left + (full.Right - full.Left + num - num2) / 2;
                        break;
                    }
                    if (full.AlignmentPoint < m_centerWidth)
                    {
                        m_leftList.Add(full);
                    }
                    else if (full.AlignmentPoint < m_rightWidth)
                    {
                        m_centerList.Add(full);
                    }
                    else
                    {
                        m_rightList.Add(full);
                    }
                }
            }
            m_leftList.Sort(ReportItemInfo.CompareTopsThenLefts);
            m_centerList.Sort(ReportItemInfo.CompareTopsThenLefts);
            m_rightList.Sort(ReportItemInfo.CompareTopsThenLefts);
            left   = RenderString(m_leftList, excel);
            center = RenderString(m_centerList, excel);
            right  = RenderString(m_rightList, excel);
        }
 protected void Page_Load(object sender, EventArgs e)
 {
     _excelGenerator = new ExcelGenerator();
 }
Пример #30
0
 public ExcelGenerator_Test()
 {
     excelGenerator = new ExcelGenerator("anand.xlsx", "uiSheet", "dataSheet");
 }
 public HomeController(ITimetableProvider provider, IDefaultDateProvider dateProvider, IExcelGenerator excelGenerator)
 {
     this.provider       = provider;
     this.dateProvider   = dateProvider;
     this.excelGenerator = excelGenerator;
 }
Пример #32
0
 public BorderInfo(RPLStyleProps style, bool omitBorderTop, bool omitBorderBottom, IExcelGenerator excel)
 {
     this.m_omitBorderTop    = omitBorderTop;
     this.m_omitBorderBottom = omitBorderBottom;
     BorderInfo.FillAllBorders(style, ref this.m_leftBorder, ref this.m_rightBorder, ref this.m_topBorder, ref this.m_bottomBorder, ref this.m_backgroundColor, excel);
 }