//----------------------------------------------------------------------------------------------------x /// <summary>Adds a report object to the container.</summary> /// <param name="rX">X-coordinate of the report object</param> /// <param name="rY">Y-coordinate of the report object</param> /// <param name="repObj">Report object to add to the container</param> public new void Add(Double rX, Double rY, RepObj repObj) { //Added By TechnoGuru - [email protected] - http://www.borie.org/ //Here we handle image comosed of severals images if (repObj is RepImage) { RepImage repImage = repObj as RepImage; using (Image image = Image.FromStream(repImage.stream)) { if (image.RawFormat.Equals(ImageFormat.Tiff)) { Guid objGuid = (image.FrameDimensionsList[0]); System.Drawing.Imaging.FrameDimension objDimension = new System.Drawing.Imaging.FrameDimension(objGuid); // Numbre of image in the tiff file int totFrame = image.GetFrameCount(objDimension); if (totFrame > 1) { // Saves every frame in a seperate file. for (int i = 0; i < totFrame; i++) { image.SelectActiveFrame(objDimension, i); string tempFile = Path.GetTempFileName() + ".tif"; if (image.PixelFormat.Equals(PixelFormat.Format1bppIndexed)) { ImageCodecInfo myImageCodecInfo; myImageCodecInfo = GetEncoderInfo("image/tiff"); EncoderParameters myEncoderParameters; myEncoderParameters = new EncoderParameters(1); myEncoderParameters.Param[0] = new EncoderParameter(Encoder.Compression, (long)EncoderValue.CompressionCCITT4); image.Save(tempFile, myImageCodecInfo, myEncoderParameters); } else { image.Save(tempFile, ImageFormat.Tiff); } FileStream stream = new System.IO.FileStream(tempFile, FileMode.Open, FileAccess.Read); if (i == 0) { repImage.stream = stream; repObj = repImage as RepObj; } else { new Page(report); RepImage di = new RepImageMM(stream, Double.NaN, Double.NaN); report.page_Cur.AddMM(0, 0, di); } } } } } } base.Add(rX, rY, repObj); }
private void Tlm_NewContainer(Object oSender, TableLayoutManager.NewContainerEventArgs ea) { new Page(this); if (page_Cur.iPageNo == 1) { FontProp fp_Title = new FontPropMM(fd, 3); fp_Title.bBold = true; RepImage di = new RepImageMM(this.Ruta, Double.NaN, Double.NaN); page_Cur.AddLT_MM(rPosLeft, rPosTop, di); page_Cur.AddCT_MM(rPosLeft + (rPosRight - rPosLeft) / 2, rPosTop + di.rHeightMM, new RepString(fp_Title, this.Title)); FontProp fp_Fecha = new FontPropMM(fd, 1.8); page_Cur.AddLT_MM(rPosRight, rPosTop, new RepString(fp_Fecha, DateTime.Now.ToShortDateString())); FontProp fp_SubTitle = new FontPropMM(fd, 2); fp_SubTitle.bBold = true; page_Cur.AddLT_MM(rPosLeft, rPosTop + rPosTop, new RepString(fp_SubTitle, Subtitle1)); ea.container.rHeightMM -= (fp_Title.rLineFeedMM + di.rHeightMM + fp_SubTitle.rLineFeed); // reduce height of table container for the first page } else { FontProp fp_Title = new FontPropMM(fd, 2); fp_Title.bBold = true; page_Cur.AddLT_MM(rPosLeft, rPosTop, new RepString(fp_Title, Subtitle1)); //page_Cur.AddAligned(rPosLeft, RepObj.rAlignRight, rPosTop, RepObj.rAlignTop, new RepString(fp_SubTitle, DateTime.Now.ToShortDateString())); //RepImage di = new RepImageMM(this.Ruta, Double.NaN, Double.NaN); //page_Cur.AddLT_MM(rPosLeft,rPosTop,di); //page_Cur.AddCT_MM(rPosLeft + (rPosRight - rPosLeft) / 2, rPosTop + di.rHeightMM, new RepString(fp_Title, this.Title)); //FontProp fp_SubTitle = new FontPropMM(fd, 2); //fp_SubTitle.bBold = true; //page_Cur.AddLT_MM(rPosLeft,rPosTop + rPosTop,new RepString(fp_SubTitle, Subtitle1)); ea.container.rHeightMM -= (fp_Title.rLineFeedMM); } page_Cur.AddMM(rPosLeft, rPosBottom - ea.container.rHeightMM, ea.container); }
//----------------------------------------------------------------------------------------------------x /// <summary>Creates a new page</summary> /// <param name="oSender">Sender</param> /// <param name="ea">Event argument</param> private void Tlm_NewContainer(Object oSender, TableLayoutManager.NewContainerEventArgs ea) { new Page(this); // first page with heading if (page_Cur.iPageNo == 1) { FontProp fp_Title = new FontPropMM(fd, 2); FontProp fp_Subtitle = new FontPropMM(fd, 2); RepImage di = new RepImageMM(this.Ruta, Double.NaN, Double.NaN); page_Cur.AddLT_MM(rPosLeft, rPosTop, di); page_Cur.AddLT_MM(rPosLeft, rPosTop + di.rHeightMM, new RepString(fp_Title, this.Title)); page_Cur.AddLT_MM(rPosLeft, rPosTop + di.rHeightMM + fp_Title.rLineFeedMM, new RepString(fp_Subtitle, this.Subtitle)); ea.container.rHeightMM -= (fp_Subtitle.rLineFeedMM + fp_Title.rLineFeedMM + di.rHeightMM); // reduce height of table container for the first page } // the new container must be added to the current page page_Cur.AddMM(rPosLeft, rPosBottom - ea.container.rHeightMM, ea.container); }