Ejemplo n.º 1
0
        internal static byte[] Render(GanttView ganttView, bool generateDataXml, string styleFilePath, int portionX, int portionY, int portionWidth, int portionHeight, int itemsPerPage, int pageNumber)
        {
            using (MemoryStream stream = new MemoryStream())
            {
                if (generateDataXml)
                {
                    ganttView.GenerateDataXml(Encoding.UTF8, stream);
                }
                else
                {
                    ganttView.LoadStyleSheetFromFile(styleFilePath);
                    ganttView.ApplyStyleSheet();

                    if (portionY < 0)
                    {
                        portionHeight = Convert.ToInt32(ganttView.CalculateHeadHeight());
                    }

                    if (portionHeight > 0 && portionWidth > 0)
                    {
                        ganttView.RenderPortion(new Point(portionX, portionY), new Size(portionWidth, portionHeight), itemsPerPage, pageNumber, ImageFormat.Png, stream);
                    }
                }
                return(stream.ToArray());
            }
        }