Zum Hauptinhalt gehen

System.Drawing.Bitmap does not implement IXmlSerializable Interface

Kommentare

10 Kommentare

  • Permanently deleted user

    Bumped into this problem in the past, but never resolved it. According to past postings, the bitmap assignment to the dictionary is a server side activity, and it was recommended that any server side activity be put inside it's own "Server Scope" sequence. At the end of that sequence, you need assign the bitmap = nothing, after the bitmap has been added to the datatable.

    I've done this, but I am still getting the bitmap serialization error. Below is the portion of my workflow that shows this server side sequence.

    /customer/servlet/servlet.FileDownload?file=00P6000000elzRcEAI

    I'm attempting to juggle two bitmap images.... one for the main map and the other for the over view map.

    Any suggestions.....?

    Walter

     

    0
  • Permanently deleted user

    Hi Walter

    I would suggest that you save the Bitmaps to  files and pass the url in the dictionary instead and get the script in the report to load the image (BitMap) into the report.

    Regards

    Ralph

    0
  • Permanently deleted user

    Ralph,

    Thanks for your response. Any possibility of a small snippet of code so I can see how this is done?

    Walter

    0
  • Permanently deleted user

    Hi Walter

    On review Walter I have been doing this for reporting on collections of feature. ie a FeatureSet

    So the following is done for each Graphic in the Featureset

    1. create the BitMap
    2. save the BitMap to file using the WriteFile Activity
    3. add a new Attribute to the Graphic called urlMapImage and setting the value of it to the Url to the location of the saved image.

     

    In the .rpx you would have on the second tab in the Report Designer something along the lines of:

     

    public void GroupHeader1_Format()

     

            {        

     

           //image file urls have been saved to a file location in the workflow and so do not have to be downloaded within this script

     

          string URL = Convert.ToString(rpt.Fields["urlMapImage"].Value);

     

         Picture PictureProperty = rpt.Sections["GroupHeader1"].Controls["detailPicture1"] as Picture;  

     

           Image image2 = Image.FromFile(URL);

     

             PictureProperty.Image = image2;

     

            }

     

     

    Where:

    • urlMapImage is the Attribute that was added to the Graphic
    • the report that the sample is from has a GroupHeader called GroupHeader1 and there is a Picture control called detailPicture1

     

    Hope that makes sense

    Regards

    Ralph

     

    0
  • Permanently deleted user

    Ralph,

    Thanks again. I've used picture embedding scripts in one of my past reports... I find them quite "harry" to figure out.

    This workflow conundrum has been caused by my inability to imbed an over view map, that will show more that one property. Given that the feature maps will only display the first feature encountered, I cannot get a simple over view map to display in my report.

    That's why I started to investigate the use of a template report, but I need two images to display.

    Walter

    0
  • Permanently deleted user

    Hi Walter

    I have done this by adding two attributes to a Graphic, one for the 'map' of the single Graphic and another of all of the Graphics.

    Then in the report:

    Have a Picture in the ReportHeader

    and use the following script:

     

                 public void ReportHeader1_Format()

     

            {

     

                try

     

                {

     

                    string URL = Convert.ToString(rpt.Fields["urlMapAll"].Value);

                    //Setting up the image to retrieve webrequest

     

                    System.Drawing.Image pinImage = null;

     

                    System.Net.WebRequest req = System.Net.WebRequest.Create(URL);

     

                    

     

    req.Credentials = new System.Net.NetworkCredential("user","password","domain");

                    using (System.Net.WebResponse response = req.GetResponse())

     

                    

     

                    using (System.IO.Stream stream = response.GetResponseStream())

     

                    {

     

                        pinImage = System.Drawing.Image.FromStream(stream);

                        String imgFileName = @"c:\temp\image" + System.DateTime.Now.Ticks.ToString() + ".jpg";

     

                        pinImage.Save(imgFileName);

                        //PictureProperty is the name of the Picture control - your's might be a different name

                        Picture PictureProperty = rpt.Sections["ReportHeader1"].Controls["AllMap"] as Picture;

     

                        //PictureProperty.HyperLink = URL;

     

                        //PictureProperty.DataField = URL;

                        Image image2 = Image.FromFile(imgFileName);

                        PictureProperty.Image = image2;

     

                    }

     

                }

     

                catch

     

                {

     

     

     

                }

     

                }

     

    Not as clean as I might like but it works.

     

    Ralph

    0
  • Permanently deleted user

    Ralph,

    Adding two attributes to a Graphic... do you mean creating another field and then populating a value to the original graphical element

    the user has selected?

    Walter

    0
  • Permanently deleted user

    Yes using an Assign Activity with:

    item.Attributes("urlMapAll") = urlMapAll

     

    0
  • Permanently deleted user

    Ralph,

    Appreciate your patience today.

    Walter

    0
  • Permanently deleted user

    No problem, hopefully by the end of your afternoon you will have it going.  ;-)

    Regards

    Ralph

    0

Bitte melden Sie sich an, um einen Kommentar zu hinterlassen.