If it is just .pptx that you need then you can write your own - all the information required is in ISO 29500 which can be downloaded freely.
If your time is free then no problem, but if you are being paid for your time (this is going to be a lengthy project) buying a library may be more cost effective.
For .ppt files I'm not sure. I have previously used NPOI for .xls, it may do .ppt too, you would need to have a look.
Sorry, no other ideas. A commercial library or learning the office powerpoint binary format (probably not worthwhile as it's pretty much been replaced by the open and easier for coding pptx format) and rolling your own may be all that's left.
I have a question about how to modify the C# 2008 desktop foreach (String RFile in RFiles) block of code and/or the code that is surrounding this block of code. The code I am referring
to is listed below. Originally the code was setup to select files in a specific file directory. Now the requirements have changed where I need to loop through 4 subfoler directories that are at the same folder level. The 4 folder levels will be: 1. C:\customer\Mon_year\Cancel, 2. C:\customer\Mon_year\ED, 3. C:\customer\Mon_year\UI, and 4. C:\customer\Mon_year\UI.
Right now these are the only folders that will be setup at this level in the directory structure. However I can see how there can potentially be other directories created at this
level in the future.
I would like to be able to resue the foreach (String RFile in RFiles) block without repeating the 4 times.
Thus can you show me how to modify this code and/or tell me how I can change this code?
I just refactored your code, it goes through your root dir and look for the sub dirs that you wanted and check for the files you wanted. If you want to change the sub dirs or add new sub dirs, you just need to edit the "SubDirNames" array.
private string SubDirNames = new string
private List<string> GetSubDirectoryPaths(DirectoryInfo rootDir)
List<string> subDirs = new List<string>();
foreach (string subDirName in SubDirNames)
DirectoryInfo dirs = rootDir.GetDirectories(subDirName);
if (dirs.Length > 0)
string path = Path.Combine(rootDir.FullName, subDirName);
logging.Error("The location " + path + " does not exist for documents. ");
private string GetFiles(string subDir)
return (from path in Directory.GetFiles(subDir)
let name = Path.GetFileName(path)
where name.EndsWith(".pdf") ||
string packageId = "";
DateTime myDateTime = DateTime.Now.AddMonths(-1);
string fromDate = "_" + myDateTime.ToString("MMM").ToUpper() + " _" + myDateTime.ToString("yyyy");
string rootDirPath = Path.Combine(ConfigurationSettings.AppSettings["tLocation"], fromDate);
DirectoryInfo rootDir = new DirectoryInfo(rootDirPath);
logging.Error("The location " + rootDirPath + " does not exist for documents. ");
List<string> subDirPaths = GetSubDirectoryPaths(rootDir);
foreach (string subDir in subDirPaths)
string RVWFiles = GetFiles(subDir);
if (RVWFiles.Length > 0)
foreach (string RFile in RVWFiles)
string orgnizationName = "";
string contactName = "";
string fileNameWithExtension = Path.GetFileName(RFile);
string fileName = Path.GetFileNameWithoutExtension(RFile);
string Original_location = subDir;
string names = fileName.Split('_');
orgnizationName = names.TrimEnd();
contactName = names.TrimStart();
string strOrgnizationName = orgnizationName;
string items = contactName.TrimEnd().Split(' ');
string surname = items[items.Length - 1];
//--here does the processing that is required--// you cannot return here, you are still in the loop!//return null;
} //closing bracket for foreach (String RFile in RFiles)
logging.Info("packageId: " + packageId + " the location " + subDir + " does not contain any documents. ");
catch (Exception e)
logging.Error("Error Processing --> " + e.Message);
logging.Error("************* Stack Trace *******************");
// throwing an exception on exception is pointless; either catch the exception and handle it safely or let the compiler to throw the exception.//throw new Exception(e.Message);return packageId;
There are few other things, I an not sure about your "PackageId" variable, this is empty at the moment; and why are you returning the packageId when error occurs and returning "null" when success?
Second, don't throw exception on exception, it is pointless, either handle the exception or let the compiler does what it does best.
Third, if i were you, I would move the processing part of the file into a separate method too for better readability.
I hope this helps.
Think! Don't write a line of code unless you absolutely need to.
The typical way to store a password securely is typically not to store it at all. I know this sounds backwards, but what normally happens is that you hash the password beforehand and you save that hashed version to the database, along with the salt that you used to create the hash. Then, when you want to compare, you retrieve the row and perform the same hash using the salt that you saved to the database.
Now, before you ask, I've given you every keyword in there that you need to do this.
I was brought up to respect my elders. I don't respect many people nowadays.
I am doing one sample project in c#. Its lik billing project. I created combobox column in datagridview. i added items to combobox if i select one item from combobox in one row tat item should not list in next row combo box. Is it possible if yes means suggest me please.
//http://www.codeproject.com/Messages/4513781/I-have-string-1999220-how-to-parse.aspxstring theDate = "19881205";
char dateLetters = theDate.ToCharArray();
int dateNumbers = new int[theDate.Length];
int sum = 0;
for (int ind = 0; ind < theDate.Length; ind++)
Console.WriteLine("Current Total: " + sum.ToString());
dateNumbers[ind] = int.Parse(dateLetters[ind].ToString());
Console.WriteLine("Adding: " + dateNumbers[ind].ToString());
sum += dateNumbers[ind];
Console.WriteLine("New Total: " + sum.ToString());
Console.WriteLine("The sum of the numbers is: " + sum.ToString());
Console.WriteLine("Press any key to close the demo...");