이진 데이터를word 파일로 변환

1102 단어 C#
/// 
        ///         word  
        /// 
        ///      
        /// word   
        /// word       
        public string ByteConvertWord(byte[] data, string fileName)
        {
            string savePath = @"SystemWord"+FormatNowTime(2)+@"";

            if (!System.IO.Directory.Exists(GetPath() + savePath))
            {
                Directory.CreateDirectory(GetPath() + savePath);
            }
            savePath += fileName + ".doc";
            string filePath = GetPath() + savePath;

            FileStream fs;
            if (System.IO.File.Exists(filePath))
            {
                fs = new FileStream(filePath, FileMode.Truncate);
            }
            else
            {
                fs = new FileStream(filePath, FileMode.CreateNew);
            }
            BinaryWriter br = new BinaryWriter(fs);
            br.Write(data, 0, data.Length);
            br.Close();
            fs.Close();
            return savePath;
        }

좋은 웹페이지 즐겨찾기