Compare Two PPT Presentation using C#

Compare Two PPT Presentation using C#

This is the continuation part of the C# with PowerPoint Series..!

Before proceeding please go through the very important previous sessions:

1.How to create PPT using ASP NET C# | Power Point Presentation

2.Add slides in ppt at runtime using C#


Very Simple Two Steps:
Step1. On Button click we are calling the IsEqual method with two ppt input parameters. Chage the file name according if required.

        protected void Button1_Click(object sender, EventArgs e)
        {
             IsEqual(Server.MapPath("~/App_Data/Temp.ppt"), Server.MapPath("~/App_Data/Temp2.ppt"));
        }

Step2. Add this piece of code. 
         private bool IsEqual(string ppt1, string ppt2)
        {
            byte[] ppt1byte = File.ReadAllBytes(ppt1);
            byte[] ppt2byte = File.ReadAllBytes(ppt2);
            if (ppt1byte.Length == ppt2byte.Length)
            {
                for (int i = 0; i < ppt1byte.Length; i++)
                {
                    if (ppt1byte[i] != ppt2byte[i])
                    {
                        return false;
                    }
                }
                return true;
            }
            return false;
        }
            
         

If you have any doubt please leave a comment.
Watch the video:

No comments:

Post a Comment

Your feedback is important.
Visit www.techwebdots.in