组织和打印CSV数据 [英] Organize and Print CSV data
问题描述
男孩,这应该是一个简单的代码,但我不知道如何使b
实现它。
我有一个CSV文件显示在一个目录中,该目录中有4个字段需要
才能打印在标签上。 CSV的每一行看起来像
这个:
AcctNo,姓名,垃圾,垃圾,地址,垃圾,PhoneNo
>
我需要阅读CSV的每一行并将其打印到Avery Label库存
(每张30张标签,3列,10行)。我还需要它们从打印机上的特定托盘中拉出
。
结果看起来应该是这样的:
吉姆史密斯玛丽史密斯John Doe
123任何街道50第一街12楼Maple ST
8542115 12345678 9858574
555-555- 1212 555-555-1111 555-555-2222
我认为步骤是这样的:
1.观察CSV文件的目录
2.使用StreamReader读取CSV的每一行
3.删除字段3,4和6(垃圾字段)
4 。为此订单组织字段:姓名,地址,帐号,电话号码
5.选择特定打印机的相应托盘
6.打印3行记录,10列。
我知道Word / Excel可以读取CSV,进行mailmerge并输出标签
但我的客户对VB.net解决方案感兴趣。 />
这样太复杂了吗?关于如何开始的任何想法?
提前致谢。
Boy, this should be a simple bit of code but I can''t figure out how to
make it happen.
I have a CSV file shows up in a directory that has 4 fields that need
to be printed on labels. Each line of the CSV looks something like
this:
AcctNo, Name, junk, junk, Address, junk, PhoneNo
I need to read each line of the CSV and print them to Avery Label stock
(30 labels per sheet, 3 columns, 10 rows). I also need them to pull
from a specific tray on the printer.
The result should look something like this:
Jim Smith Mary Smith John Doe
123 any street 50 First st 12 Maple ST
8542115 12345678 9858574
555-555-1212 555-555-1111 555-555-2222
I am thinking the steps are something like this:
1. Watch the directory for a CSV file
2. Use StreamReader to read each line of the CSV
3. Drop fields 3,4 and 6 (the Junk fields)
4. Organize fields to this order: Name, address, AcctNo, PhoneNo
5. Select the appropriate tray of a specific printer
6. Print the records in 3 rows, 10 columns.
I know Word/Excel can read a CSV, do a mailmerge and output the labels
but my customer is interested in a VB.net solution.
Is this way too complicated? Any ideas on how to get started?
Thanks in advance.
推荐答案
I会推荐Word / Excel组合。如果你的客户坚持要重新发明轮子,请给他充电一次!
T
Jchick写道:
I would recommend the Word/Excel combo. If your customer insists on
reinventing the wheel, charge him double!
T
Jchick wrote:
>男孩,这应该是一个简单的代码,但我不知道如何实现它。
我有一个CSV文件显示在一个目录中,该目录有4个字段需要
打印在标签上。 CSV的每一行看起来都像
这个:
AcctNo,Name,垃圾,垃圾,地址,垃圾,PhoneNo
我需要阅读每一行CSV并将其打印到Avery Label库存
(每张30张标签,3列,10行)。我还需要它们从打印机上的特定托盘中拉出来。
结果应该是这样的:
Jim Smith Mary Smith John Doe /> 123任何街道50第一街12楼枫树ST
8542115 12345678 9858574
555-555-1212 555-555-1111 555-555-2222
我在想台阶是这样的:
1。观看CSV文件的目录
2。使用StreamReader读取CSV的每一行
3。删除字段3,4和6(垃圾字段)
4。按此顺序组织字段:姓名,地址,AcctNo,PhoneNo
5。选择特定打印机的相应纸盘
6。打印3行,10列记录。
我知道Word / Excel可以读取CSV,做邮件并输出标签
但我的客户对VB.net解决方案感兴趣。
这样太复杂了吗?关于如何开始的任何想法?
提前致谢。
>Boy, this should be a simple bit of code but I can''t figure out how to
make it happen.
I have a CSV file shows up in a directory that has 4 fields that need
to be printed on labels. Each line of the CSV looks something like
this:
AcctNo, Name, junk, junk, Address, junk, PhoneNo
I need to read each line of the CSV and print them to Avery Label stock
(30 labels per sheet, 3 columns, 10 rows). I also need them to pull
from a specific tray on the printer.
The result should look something like this:
Jim Smith Mary Smith John Doe
123 any street 50 First st 12 Maple ST
8542115 12345678 9858574
555-555-1212 555-555-1111 555-555-2222
I am thinking the steps are something like this:
1. Watch the directory for a CSV file
2. Use StreamReader to read each line of the CSV
3. Drop fields 3,4 and 6 (the Junk fields)
4. Organize fields to this order: Name, address, AcctNo, PhoneNo
5. Select the appropriate tray of a specific printer
6. Print the records in 3 rows, 10 columns.
I know Word/Excel can read a CSV, do a mailmerge and output the labels
but my customer is interested in a VB.net solution.
Is this way too complicated? Any ideas on how to get started?
Thanks in advance.
Hello Jchick,
ADO.Net相对简单。使用OdbcConnection / Command
或OleDbConnection / Command以及相应的连接字符串(请参阅connectionstrings.com)。
除此之外,您的方法看起来很好。
-Boo
Hello Jchick,
This is relatively straight forward with ADO.Net. Use a OdbcConnection/Command
or OleDbConnection/Command with the appropriate connection string (see connectionstrings.com).
Other than that, your method looks fine.
-Boo
男孩,这应该是一个简单的代码,但我不知道如何
让它成为现实。
我有一个CSV文件显示在一个目录中,该目录有4个字段需要
打印在标签上。 CSV的每一行看起来像
这个:
AcctNo,姓名,垃圾,垃圾,地址,垃圾,PhoneNo
>
我需要阅读CSV的每一行并将其打印到Avery Label
stock(每张30张标签,3列,10行)。我还需要它们来自打印机上特定托盘的
拉。
结果看起来应该是这样的:
吉姆史密斯玛丽史密斯John Doe
123任何街道50第一街12楼Maple ST
8542115 12345678 9858574
555-555- 1212 555-555-1111 555-555-2222
我认为步骤是这样的:
1.观看CSV文件的目录
2.使用StreamReader读取CSV的每一行
3.删除字段3,4和6(垃圾字段)
4.组织字段到此订单:名称,地址,AcctNo,PhoneNo
5.选择特定打印机的相应托盘
6.以3行10列打印记录。 />
我知道Word / Excel可以读取CSV,进行mailmerge并输出标签
但我的客户对VB.net解决方案感兴趣。
>
这样太复杂了吗?关于如何开始的任何想法?
提前致谢。
Boy, this should be a simple bit of code but I can''t figure out how to
make it happen.
I have a CSV file shows up in a directory that has 4 fields that need
to be printed on labels. Each line of the CSV looks something like
this:
AcctNo, Name, junk, junk, Address, junk, PhoneNo
I need to read each line of the CSV and print them to Avery Label
stock (30 labels per sheet, 3 columns, 10 rows). I also need them to
pull from a specific tray on the printer.
The result should look something like this:
Jim Smith Mary Smith John Doe
123 any street 50 First st 12 Maple ST
8542115 12345678 9858574
555-555-1212 555-555-1111 555-555-2222
I am thinking the steps are something like this:
1. Watch the directory for a CSV file
2. Use StreamReader to read each line of the CSV
3. Drop fields 3,4 and 6 (the Junk fields)
4. Organize fields to this order: Name, address, AcctNo, PhoneNo
5. Select the appropriate tray of a specific printer
6. Print the records in 3 rows, 10 columns.
I know Word/Excel can read a CSV, do a mailmerge and output the labels
but my customer is interested in a VB.net solution.
Is this way too complicated? Any ideas on how to get started?
Thanks in advance.
Boo,
我没看到OleDB或ODBC可以帮助OP吗?
你能解释得更远吗,我会保留它自己的程序。
Cor
" GhostInAK" < gh ******* @ bermail.com的gmail.comschreef
新闻:c7 *********************** ***@news.microsoft.c om ...
Boo,
I don''t see where OleDB or ODBC can help the OP?
Can you explain that further, I would keep it with his own procedure.
Cor
"GhostInAK" <gh*******@gmail.comschreef in bericht
news:c7**************************@news.microsoft.c om...
Hello Jchick,
这是相对简单的ADO.Net。使用
OdbcConnection / Command或OleDbConnection / Command以及相应的
连接字符串(请参阅connectionstrings.com)。
除此之外,您的方法看起来很好。
-Boo
Hello Jchick,
This is relatively straight forward with ADO.Net. Use a
OdbcConnection/Command or OleDbConnection/Command with the appropriate
connection string (see connectionstrings.com).
Other than that, your method looks fine.
-Boo
>男孩,这应该是一段简单的代码,但我可以'弄清楚如何实现它。
我有一个CSV文件显示在一个目录中,该目录有4个字段需要
打印在标签上。 CSV的每一行看起来都像
这个:
AcctNo,Name,垃圾,垃圾,地址,垃圾,PhoneNo
我需要阅读每一行CSV并将其打印到Avery Label
库存(每张30张标签,3列,10行)。我还需要它们从打印机上的特定托盘拉出来。
结果看起来应该是这样的:
Jim Smith Mary Smith John Doe /> 123任何街道50第一街12楼枫树ST
8542115 12345678 9858574
555-555-1212 555-555-1111 555-555-2222
我在想这些步骤是这样的:
1。观看CSV文件的目录
2。使用StreamReader读取CSV的每一行
3。删除字段3,4和6(垃圾字段)
4。按此顺序组织字段:姓名,地址,AcctNo,PhoneNo
5。选择特定打印机的相应纸盘
6。打印3行,10列记录。
我知道Word / Excel可以读取CSV,进行mailmerge并输出标签
但我的客户对VB.net解决方案感兴趣。
这样太复杂了吗?关于如何开始的任何想法?
提前致谢。
>Boy, this should be a simple bit of code but I can''t figure out how to
make it happen.
I have a CSV file shows up in a directory that has 4 fields that need
to be printed on labels. Each line of the CSV looks something like
this:
AcctNo, Name, junk, junk, Address, junk, PhoneNo
I need to read each line of the CSV and print them to Avery Label
stock (30 labels per sheet, 3 columns, 10 rows). I also need them to
pull from a specific tray on the printer.
The result should look something like this:
Jim Smith Mary Smith John Doe
123 any street 50 First st 12 Maple ST
8542115 12345678 9858574
555-555-1212 555-555-1111 555-555-2222
I am thinking the steps are something like this:
1. Watch the directory for a CSV file
2. Use StreamReader to read each line of the CSV
3. Drop fields 3,4 and 6 (the Junk fields)
4. Organize fields to this order: Name, address, AcctNo, PhoneNo
5. Select the appropriate tray of a specific printer
6. Print the records in 3 rows, 10 columns.
I know Word/Excel can read a CSV, do a mailmerge and output the labels
but my customer is interested in a VB.net solution.
Is this way too complicated? Any ideas on how to get started?
Thanks in advance.
这篇关于组织和打印CSV数据的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!