Extract file from .xsn using c# - c#

I need to extract file (template.xml) from .xsn (InfoPath form template) using C#.
How can I do this? I tried to do it using "DotnetZip" and "Microsoft System.IO.Compression.DeflateSteam" but it doesn't work.
Any help please?
Thanks in advance!

XSN is not a Zip file, it is CAB.
Here is a blog article talking about manipulation of XSN in JavaScript - http://blogs.msdn.com/b/infopath/archive/2004/05/04/126147.aspx and another one with some samples I've never used http://social.msdn.microsoft.com/Forums/en/csharpgeneral/thread/58d9cf34-9a43-4d58-96c7-44bff69ca5d4.
I've used "Unpack XSN file using extract.exe utility to the local temporary directory".
(Search for "C# cab extract" http://www.bing.com/search?q=c%23+cab+extract for more code samples)

Related

Can I save a DOCX file as HTML using the DOCX Library?

I am using the DOCX library to manipulate *.docx files.
I would like to save a *docx file as an html file, but this code:
using (DocX sourceDoc = DocX.Create(sourceFilename))
{
sourceDoc.SaveAs(sourceHTMLFileName);
}
...does not work (sourceHTMLFileName is "Bla.html").
Is it possible? If so, how?
The author of DocX has stated in a blog post that his library does not support this feature yet. I got the link from the codeplex page for the library.)
Quote from the link:
I would love to add this functionality to DocX, however there is a problem.
[...]
The only easy way to do this conversion, is to use Microsoft’s Office interop libraries
[...]
Is there no way to do conversions without having Word.exe installed on my machine. I didn’t say that, I said there is no easy way. This looks very promising, now if I could only find the time.
He suggests a workaround using Interop but that might not be possible depending on your environment.
Using SaveAs with a file that ends in .html simply saves a .docx file with the wrong extension; there is no conversion done.

Making a pdf copy of a csv file programmatically in C#

I have a csv file and I need to make a pdf copy in the console application that creates the csv. All I have found 3rd party libraries for working with pdf but I don't want to use that. Can I just make a copy and save it as a pdf? If so, how?
Also, I'm using C#, in case you didn't read the title.
Try the below link hope it will help you.
http://sourceforge.net/project/platformdownload.php?group_id=72954
You can open the csv with excel.
than use office PIA (interop) to save as PDF.
see:
Can I use Microsoft Office 2010: Primary Interop Assemblies to convert word,excel to PDF
first read the csv files using c# code, and load that data's into DataTable,
write the datatable values into pdf file using c#
may this idea will help 4 u

How do I edit a .PDF file while its a resource?

I've been looking around on the web for an answer to a perplexing problem. I'm trying to code a program in C# and I'm looking for a snippet of code that'll take any information a user would input, i.e using a textbox or a check box, and transfer said information onto a .PDF file that I've added as a resource.
Right now I'm using Visual Studio 2008 for my coding, any help would be appreciated.
You can use librairies to create PDF on the fly:
ITextSharp
PDF's are a proprietary format. PDF4Net is a pretty good library for merging information via XDF into PDF's, but you are going to have a lot of trouble trying to do this on your own natively.

Creating a PDF from microsoft access database

I would like to create a PDF from the data i have in a microsoft access database. Can someone please tell me what I should use to make this happen? Any tips and steps are appreciated.
One way of doing it is creating a report (you can use CrystalReports) against your AccessDB data, and then exporting that report to PDF.
Other way of doing it is creating a little program in C# and generate a PDF using an Open Source PDF generator like iTextSharp, PDFCreator or Report.NET. There are also a lot of commercial libraries available.
Other way of doing it is creating a little Java program and generate PDF using iText.
Other way of doing it is creating a little insert your favorite programming language here and generate a PDF using a suitable library for it.
try this old link I have used this and it produces PDF direcly fron access full credits to Mr Lebans just follow his clear instructions
http://www.lebans.com/reporttopdf.htm

How to extract files from .CAB file using C#.Net?

I have a CAB file generated from CABARC.EXE. I need to extract the file using ASP.Net C#.Net.
How to do it in C#.net itself? I don't want to use the same CABARC.EXE for extraction. Because we don't use this tool in production environment.
Please give your valuable suggestions/code to achieve this task.
Thanks in advance
Ganesh.
I googled this for you.
http://www.codeproject.com/KB/files/CABCompressExtract.aspx
Looks like it does everything you want.
If you want a native C# solution I suggest you start with the file specification for CAB files here:
http://msdn.microsoft.com/en-us/library/cc483132(EXCHG.80).aspx
Have a look at https://learn.microsoft.com/en-us/previous-versions//bb267310(v=vs.85)#microsoft-cabinet-file-format
There you have a file format description for the CAB file.

Categories

Resources