예제 #1
0
        /// <summary>
        /// 把body导出为文件流
        /// </summary>
        /// <param name="body"></param>
        /// <param name="filePath"></param>
        public static void SaveBodyToFile(IBody2 body, string filePath)
        {
            IStream stream = null;

            CreateStreamOnHGlobal(IntPtr.Zero, true, ref stream);
            body.Save(stream);

            var comStream = new ComStreamBody(ref stream, false, false);

            using (var fileStream = File.Create(filePath))
            {
                comStream.Seek(0, SeekOrigin.Begin);
                comStream.CopyTo(fileStream);
            }
        }