示例#1
0
        /// <summary>
        /// Execute the MergeImageFieldEvent to merge the images to corresponding image fields
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="args"></param>
        private void MergeField_ProductImage(object sender, MergeImageFieldEventArgs args)

        {
            Assembly assembly = typeof(MailMerge).GetTypeInfo().Assembly;

#if COMMONSB
            string rootPath = "SampleBrowser.Samples.DocIO.Samples.Templates.";
#else
            string rootPath = "SampleBrowser.DocIO.Samples.Templates.";
#endif

            //Binds image from file system during mail merge

            if (args.FieldName == "Photo")

            {
                string ProductFileName = args.FieldValue.ToString();

                Stream inputStream = assembly.GetManifestResourceStream(rootPath + ProductFileName);

                args.ImageStream = inputStream;
            }
        }