How to import csv files with schema [closed] - c#

It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center.
Closed 9 years ago.
I am looking for a way to import csv files with schma (.ini file).
I want import the csv into a datatable.
I don't want to use excel interop, because of known issues in running it on windows services.
Is there a way to do so in another tool or technology such as OpenXML?
I've already tested Aspose's and Syncfusion's tools - and it seems they can't offer a solution here. Would appreciate any help.

You can do this with an ODBC connection, which treats the text file as a database. Just make sure the .ini file is in the same location as the text-file.
Recording a macro in Excel from the following steps will give you some base code to work with.
Data > Import External Data > New Database Query
Select In Create New Data Source,
choose a name
select the driver - Microsoft Text Driver (*.txt, *.csv)
click Connect and in ODBC Text Setup select the folder containing the csv file
select a default table - the csv file (optional)
A similar process can be coded in C# without using Interop. It just uses a database connection, probably OleDbConnection.

Related

Insert page numbers in OpenXML document using C# [closed]

It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center.
Closed 9 years ago.
Where can I obtain C# sample code for the Open XML SDK Library?
Using Word, create two documents -- one that does not contain page numbers, and one that is exactly the same but does contain page numbers how you want to see them.
Download the Open XML SDK Productivity Tool -- http://www.microsoft.com/en-us/download/details.aspx?id=30425 . This tool can show you exactly the C# code that you need to produce any supplied Office document.
Use the Productivity Tool to open the two documents. Compare and contrast to find the solution that you need.

How to format Excel worksheet? [closed]

It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center.
Closed 10 years ago.
Am using Microsoft.ACE.OleDb to write data to excel. I want to format the worksheet by using Microsoft.ACE.OleDb only? My requirement is i dont want to use 3rd party libraries like Microsoft.InterOp and EPPlus. How can i do this?
No, you can't. Microsoft.ACE.OleDb allows you to operate data, not to format cells and text
If you don't want to use Interop.Excel, you should look at Late binding
The only reliable way to create a real Excel worksheet with formatting is using Aspose.Cells for .NET.
There also is ExcelPackagePlus on CodePlex, which is opensource, but it has a bug that prevents reading or writing workseets when your text contains a www/mail-Link that is invalid, e.g. a password that contains an # sign, with excel incorrectly interpreting this as a link.
There is also carlosag.excelwriter, but it doesn't really create an excel file, it creates an XML file that can be read and displayed by excel.
Excel 2010 however issues a warning, "Not a valid excel file", that may potentially scare off users.
I would not recommend using ACE.OleDb, you will run into 32/64 bit issues, as the ACE drivers are already on life-support and deprecated and thus not available on 64 bit windows (matters if you have 64 bit excel as well).
For the same reason, I would not use Interop.Excel.

Removing text from various document types [closed]

It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center.
Closed 10 years ago.
I am writing a C# asp.net web application that receives CV's in various formats i.e. doc, docx, pdf, text, etc.
I was wondering if there was a simple way I could remove certain information from the document not matter what file type it is and then pass on the edited file to the end user?
The information to be removed will be held in a string
You will need to parse each file type using separate APIs.
.docx can be parsed using: http://docx.codeplex.com/
.pdf can be parsed using: http://www.pdfsharp.net/
etc.
If you use a streamreader (http://msdn.microsoft.com/en-us/library/system.io.streamreader.aspx) to read through the document, you could use the ReadToEnd function to store everything in a string, then use the function:
MyString.Replace("Something to replace", "");
to remove the matches. If the file formats cannot be read in as a string, you'll have to consider different options. However, there are likely faster solutions given the file formats, and it's likely not stored as simply.

From mdb Access application to windows application C# [closed]

It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center.
Closed 10 years ago.
I've to recode a small access mdb application using c#. What' the best way to re-use and store data now stored in access tables?
The easiest way is to just leave it in the Access (JET) MDB format. A C# application can work against that format just fine.
The decision which database to use ultimately depends mostly on your project requirements. The fact that you are using C# isn't really a major consideration in which one you pick.
You can use the Upsizing Wizard from Microsoft to migrate the database to SQL Server. If your number of connected users, and database sizing are small enough you can use SQL Server Express free from Microsoft.

How to show video file and word file in gridview from the database? [closed]

It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center.
Closed 11 years ago.
im the beginner of .net, im doing the project to save and retrive the files in asp.net with c# , i done saved the files to sql in binary format,
and i dont know how to retrive the file in grid view,
also i dont know how to play the video file in gridview,
can any one help to make that please..
It is not a good practice to save large sized files (like video,documents etc) in database (as binary or varbinary). Instead you upload them to a structured folder outside root and save only the file name(name/path) in the database.
If you really want to do as you asked do the following steps:
1. Convert the binary file to a byte array as follows,
byte[] byteArray=GetBinaryFromDB().TOArray();
2. Then pass the byte array to the following function within System.IO namespace,
File.WriteAllBytes (strng path, byte[] bytes) //This will save your file in the path you specified as first argument.
In order to play the video file you should design a suitable API (including a flash movie,light box/light window etc)..

Categories