Read and write file to docx file.
Hi,I am reading a docx file content with below code
string filePath = @"D:\Projects\Webapi\Docs\test1.docx";
using (FileStream fs =File.Open(filePath, FileMode.Open)) {
content = new byte[fs.Length];
fs.Read(content, 0, (int)fs.Length);
}
now i am creating new file with the content as below
File.WriteAllBytes(@"D:\Projects\Webapi\Docs\b.docx", content);
I am able to read and write all these things to new doc.
Now the problem is i want to break(split) the content which is in byte array.
when i am split and write to docx file, docx is showing error as invalid content or document is corrupted.
How to achieve this?
Regards,
Naresh.