Pulling output data from .txt file
Hello, I am trying to have a program that allows a user to input shopping items into the program andhave that input go to a .txt file called shoppinglist, then after the user is finished, he/she can type no to stop entering items to the list and the program will then pull all the info entered to the .txt file and output it to the screen, creating a shooping list for the user. My problem is that I am not quite sure how to output the data from the .txt file to the screen. Here is my code.
import java.io.*; // uses the java io library for the
import java.util.*; // BufferedReader class
public class week5
public static void main(String [] args)
PrintWriter inputItems = null;
try
inputItems = new PrintWriter(new FileOutputStream("shoppinglist.txt"));
BufferedReader outputItems = null;
String line = null;
outputItems = new BufferedReader(new FileReader("shoppinglist.txt"));
line = outputItems.readLine();
outputItems.close();
catch(FileNotFoundException e)
System.out.println("File file.txt not found");
System.out.println("or could not be opened.");
catch(IOException e)
System.out.println("Error reading from file file.txt.");
System.out.println("This program will create a shopping list:");
String keepGoing = "yes";
String item = null;
Scanner keyboard = new Scanner(System.in);
for (int count = 1; count < 999 && keepGoing.equalsIgnoreCase("yes");count++)
//ask for input, write it to a file
System.out.print("Please enter item # " + count + ": ");
System.out.print("");
item = keyboard.nextLine();
inputItems.println(count + " " + item);
//ask if you want to keep going
System.out.print("Do you wish to enter more items (yes/no): ");
System.out.print("");
keepGoing = keyboard.nextLine();
System.out.println("Your shopping list contains: " + item);
System.out.print("");
inputItems.close();
} All the above does is output the last item entered by the user, not the whole shopping list. Any help is greatly appreciated.
nim_ramesh wrote:
outputItems = new BufferedReader(new FileReader("shoppinglist.txt"));
/* I think u want to print the text here so */
line = outputItems.readLine(); // Replace this line with that while loop
outputItems.close();
He hasn't even read the user input at that point.
OP, you need to sit down and think about the exact order you want to do things in, and rewrite your code in a logical straightforward manner. It looks like you just threw some code in hoping it would work, instead of coding deliberately. I'm not insulting you or anything, I know you're new to Java. I'm just trying to give you some advice. Look at your code, and ask yourself why the following line of code appears before you've even written anything to your file:
line = outputItems.readLine();
Similar Messages
-
How to read data from txt file respectively
Hi,
I am triying to form an equation between two known points. I want to do this with the attached VI, the most critical point is that I will read the x1, y1, x2 and y2 coordinates from the same .txt file. They will be written in a .txt file and I will send them to the appropriate channel (x1, y1, x2 and y2) respectively. How can I get data in a rule from a .txt file?
Could anyone please help me with this issue,
Best regards.
Attachments:
read from txt file.vi 8 KBDear RavensFan,
Thank you very much for your helps, I am bit new to labview so I usually can not find the appropriate functions easily. And a new problem has rised in my application. I should write the A, B and C numbers in the respective series to the file 2.txt. I am able to write them in a straight forward case but I want to write the next triples (A B C) in the next row. Like this;
A1 B1 C1
A2 B2 C2
A3 B3 C3
So how can I put new line constant and space constant to my VI?
Waiting for your valuable helps,
Best regards,
Attachments:
read_from_txt_fileMOD.vi 18 KB -
Output data to txt file with full length of the field as in database
Hi
I have a problem related to output data I ntxt file on server
for eg
CONCATENATE
wa_sagadr_outtab-seqno
wa_sagadr_outtab-bpext
wa_sagadr_outtab-name_org1
wa_sagadr_outtab-country INTO wa_sagadr_text SEPARATED BY ''.
the output is separated by single space irrespective of database length of the field , I want to display all the lenth of the database field eventhough the remaining space is blank ie if a field is 20 char in dtabase and only filled with 6 char the whole 20 char lenth should be displayed in the output file
ouput as below
required format ie space equvalent to as in database lenght
000001 700006 C4 Plant AMD Export Sdn.Bhd.so on.
my format as coming single space in between only
000001 700006 C4 Plant AMD Export Sdn.Bhd
pls suggestFor this maintain an work area with the fields and structure same as the one which you want.
ten populate the work are and write to file.
concatenate will not work.
e.g.
DATA: begin of wa_sagadr_text,
seqno like wa_sagadr_outtab-seqno,
bpext like wa_sagadr_outtab-bpext,
name_org1 like wa_sagadr_outtab-name_org1,
country like wa_sagadr_outtab-country
end of wa_sagadr_text,
clear wa_sagadr_text.
wa_sagadr_text-seqno = wa_sagadr_outtab-seqno.
wa_sagadr_text-bpext= wa_sagadr_outtab-bpext.
wa_sagadr_text-name_org1 = wa_sagadr_outtab-name_org1.
wa_sagadr_text-country = wa_sagadr_outtab-country INTO wa_sagadr_text.
transfer wa_sagadr_text to outputfile
or write:/ your fields. -
SQL Loader - want to access data from .txt file but don't want to insert
Hello,
I have situation where I have some data in .txt file and I have to load that data into one of my table.
My problem is I have fundtion get_id(a,b,c) in database which I have to call while loading the data to find out value of x.
I have value of a, b and c in txt file which I can access it using POSITION(N:M) in sql loader, but After accessing that value I just want to past to get_id() function and dont want to insert into sql loader.
any helpMy control file is as below
Following field is not in database but I need to pass the value to the function to get a ESC_USER_ID. any help
OFFICE_NUM filler POSITION(32:35) ,
STATION_DESK filler POSITION(45:48),
LOAD DATA
INFILE REFERRALs.TXT
BADFILE REFERRAL_LOAD.BAD
DISCARDFILE REFERRAL_LOAD.DIS
INSERT
INTO TABLE REFERRAL
EVALUATE CHECK_CONSTRAINTS REENABLE DISABLED_CONSTRAINTS
TRAILING NULLCOLS
ID sequence (1,1),
JOB_ID POSITION (16:22) "GET_JOB_ID(:JOB_ID)" ,
CUS_ID POSITION (23:31) "GET_CUS_ID(:CUS_ID)" ,
STATUS_LU CONSTANT 'F' ,
REQUEST_USER_TYPE_LU CONSTANT 'S' ,
OFFICE_NUM filler POSITION(32:35) ,
STATION_DESK filler POSITION(45:48),
REQUEST_USER_ID POSITION(143:149) "GET_ESCUSER_ID(OFFICE_NUM,STATION_DESK,:REQUEST_USER_ID)" ,
REQUEST_DT POSITION (37:44) "to_date(:REQUEST_DT,'YYYY/MM/DD')" ,
REVIEW_USER_ID FILLER ,
REVIEW_DT FILLER ,
REFUSE_REASON_LU FILLER ,
RESULT_LU POSITION (97:97) ,
NOTIFY_STATUS_LU FILLER ,
NOTIFY_DT FILLER ,
APPOINTMENT_DT POSITION (106:113) "to_date(:APPOINTMENT_DT,'YYYY/MM/DD')" ,
RESULT_DT POSITION (98:105) "to_date(:RESULT_DT,'YYYY/MM/DD')" ,
NO_MATCH_IND CONSTANT 'N'
) -
How to initialize Object Array Data Provider (OADP)with data from txt file
Hi,
I want to show in a table some columnar data from a txt file. I ran the creator demo application on OADP successfully. http://blogs.sun.com/divas/entry/using_the_object_array_data
I created a javabean class to read a txt file.However, I am stuck at how I can fill the data into an OADP array:
I am familiar with C extensively but not much at java. can anyone help??
thanks..
dr.am.mohan raoThanks for that. I changed it a little bit, but when i ran this script, got ORA-06532: Subscript outside of limit.
declare
O_voucher_comment SYSADM.AP_COMMENT_COLL := sysadm.ap_comment_coll(null);
begin
FAS_AP_EXCEPTIONS.GET_VOUCHER_COMMENTS('FCCAN', '20494753', 0, 'KEHE', O_voucher_comment);
end;
PROCEDURE get_voucher_comments (
v_bu_in IN VARCHAR2,
v_voucher_in IN VARCHAR2,
v_line_in IN NUMBER,
v_userid IN VARCHAR2,
voucher_comment OUT sysadm.ap_comment_coll
IS
i NUMBER := 1;
v_comments VARCHAR2 (254) := ' ';
comment_type sysadm.ap_comment_type;
v_line_num NUMBER := 0;
CURSOR get_all_comment
IS
SELECT voucher_line_num, descr254_mixed FROM ps_fas_ap_comment
WHERE business_unit = v_bu_in AND voucher_id = v_voucher_in;
CURSOR get_line_comment
IS
SELECT descr254_mixed FROM ps_fas_ap_comment
WHERE business_unit = v_bu_in AND voucher_id = v_voucher_in
AND voucher_line_num = v_line_in;
BEGIN
--voucher_comment() := SYSADM.ap_comment_type (NULL, NULL, NULL, NULL, NULL, NULL);
--' ', ' ', 0, ' ', '', ' ' sysadm.ap_comment_coll
voucher_comment := sysadm.ap_comment_coll(null);
IF v_line_in = 0
THEN
OPEN get_all_comment;
LOOP
FETCH get_all_comment
INTO v_line_num, v_comments;
if i > 1
then
voucher_comment.EXTEND;
end if;
voucher_comment (i) := ap_comment_type (v_bu_in,
v_voucher_in, v_line_num, v_userid,
TO_DATE (TO_CHAR (SYSDATE, 'DD-MON-YYYY HH24:MI:SS'), 'DD-MON-YYYY HH24:MI:SS'), v_comments );
i := i + 1;
END LOOP;
ELSE
OPEN get_line_comment;
LOOP
FETCH get_line_comment
INTO v_comments;
voucher_comment.extend(6);
voucher_comment (i) := ap_comment_type (v_bu_in, v_voucher_in, v_line_num, v_userid, TO_DATE (TO_CHAR (SYSDATE, 'DD-MON-YYYY HH24:MI:SS' ), 'DD-MON-YYYY HH24:MI:SS'), v_comments);
i := i + 1;
END LOOP;
END IF;
END get_voucher_comments; -
Retrieve data from txt file to generate CWGraph plot
Please help...I'm not sure this is even possible, but here is what I need to do. I wrote a DAQ program that utilizes the CWGraph control. Each second a data point is collected by the program and displayed in one of the CWGraphs. The only problem I have is that if the program is closed or crashes for some reason, I lose the data plot in my CWGraphs. The data points are collected in a txt file which is then later worked up in Excel. My question is, is there a way to retrieve these data points from the txt file and re-generate the plots when the program is opened back up? The program would then take back over and plot along in realtime. I hope this is clear enough to understand. Feel free to ask any questions and any input would be greatly appreciated!
Hi Chris,
There is not a shipping example that would demonstrate exactly what you are looking for in your application.
The reading and writing to a file will require general VB 6.0 programming as Measurement Studio does not provide a feature to assist you with that. If you are not familiar with File I/O in VB 6.0, this site may be a good starting point: File I/O - VisualBasic Examples .
Once again, parsing the input from the text file will also require general VB 6.0 programming. I am not sure how your text file will be delimited, but you can use this example as a guide to parsing the input from the file: Parse String Using A Specific Delimiter .
To convert from strings to numbers in VB 6.0, you can use the Val() function. More information about how to use that function can be found on MSDN: Val Function .
Once you have an array of doubles, you can plot the data on your waveform graph as usual. If you are not familiar with how to plot an array to a CWGraph, please take a look at our shipping examples. The Simple Graph example is a great starting point.
Jessica
National Instruments
Product Support Engineer -
Import data from txt-file with reading column names
Hello,
after changing the the export of my simulation programm I can't use the solution postet here, wich works well. (I branded the post as soluted thats why I start a ne post)
Can anybode please tell me how to adept the code to import the new type of txt file. Here the name of the columns are in the first line aof the columns, like this (with ignoring the first lines).
"TIME " "Sitzbasis_X" "Sitzbasis_Y" "Sitzbasis_Z" "Achsklammer_Z" "Antriebsachse_Z" "Gegengewicht_Z" "Lenkachse_Z"
0.000000e+000 -5.472285e+003 -1.886681e+002 1.812099e+004 4.539113e+004 -1.252936e+005 -1.499764e+004 -9.806650e+003
1.000000e-003 -1.722846e+003 -1.141275e+002 8.443419e+003 2.475389e+004 -7.533712e+004 -1.138092e+004 -9.624729e+003
2.000000e-003 -3.964053e+002 -7.694600e+001 3.186345e+003 1.399086e+004 -5.653730e+004 -9.956198e+003 -9.311346e+003
I added an example file
Thanks for Help
Gabriel
Solved!
Go to Solution.
Attachments:
TXT-File.txt 115 KBHello Gabriel
You can use the DataPlugin Wizard (Navigator>>File>>DataPlugin Wizard) to define a new file import filter for your data. It will take only one minute.
Please found the uri file I create for you. Copy the attached file to your disk, unpack it and double click the uri file.
Then you can open your file by using "open with".
Hope this help
Attachments:
TXT_File_DataPlugin.zip 4 KB -
ABAP program to output data from SAP table to an XML format file?
hello ABAP experts,
Does anyone know how to output data from SAP table to an XML format file? Would be appreciated if someone show the detailed sample codes and we will give you reward points!
Thanks!Edited by: Jose Hugo De la cruz on Aug 19, 2009 8:23 PM
-
Cs3 Indesign problem - Pulling incorrect data from an .xlsm file.. please help
Hello,
I am hoping someone can provide me some answers here, as this problem has stumped me for a couple of days now.
I am using Adobe Indesign Cs3 - and I have been pulling excel tables into the .indd file with no problem. However, I had to upragde my version of 2003 excel, to the newer 2007 version, which inlcluded having to update the base excel files to .xlsm from their previous .xls versions.
I did not change anything else with the files.. simply used 'save as' to update the files.
After the upgrade, I relinked all instances of tables for the .indd file, and all seemed to be fine. Except when I look at anything that was pulled in as a date, is now pulling in 4 years and one day behind what it is written as in the .xlsm file it is being pulled from.
It doesnt make any sense to me how Indesign can be pulling in figures differently than how they are written in the Excel file it is pulling the data from.
Hopefully this makes sense, and someone will be able to help me here
Thanks
JAye.. the reason I have had to upgrade the excel files is because of the column limit in the .xls format. 2003 excel files will only allow columns up until the IV limit.. and my data now goes past that.
Since Indesign seems to have a huge problem trying to draw excel data/tables from anything other than 1 worksheet in an excel file, Ive had to try and create an .xlsx or .xlsm file to give me the extra columns I need for my data.
As for changing my source files.. that would be fine. Ive tried a few things with the dates, but nothing I've tried has worked so far. It reeks of a 1904 date system problem, becuase of the exact 4 years and one day off that indesign is pulling in (if you are familar with the 1904 date setting in excel, you will undertsand what Im saying) but why indesign is pulling in different data than what is visible in the source file is beyond me.
Example, the source file has a date: July 15, 2010. Indesign is pulling in July 14, 2006.
It is really bizzare. -
Is there anyway to pull the data from an iPhone/iTunes backup file?
Is there anyway to pull the data from an iPhone/iTunes backup file so it can be read and imported into a DROID phone. Have a customer with a dead iPhone and they went out and purchased a DROID as a replacement and would like all their contacts to be imported into the DRIOD. Is there any software out there that can do this?
Here is one that can at least get at the data: iPhone Backup Extractor
There may well be others of better value. Google is your friend.
You'll probably need to do something with the data you can extract, like add it to Outlook, rather than being able to send it directly to the driod.
tt2 -
Pull the data from legacy System into report and display with SAP data
Hi Friends,
My requirement is-
Create report by processing data from SAP tables and prepare output.And Before displaying the output, I have to pull the data from non-sap system which is readymade (It will come as flat file with similar fields as Report structure has) and finally display the records from both SAP and Legacy System by filtering duplicates.Steps:-
Define the file path on selection screen:-
Selection screen data
select-options (s_)
parameters (p_)
radio buttons (r_)
checkboxes (x_)
pushbuttons (b_)
SELECTION-SCREEN BEGIN OF BLOCK block1 WITH FRAME TITLE text-f01.
parameter: p_file type text_512 obligatory.
Start-of-selection.
data : l_fname type string. " File Name
l_fname = p_file .
call function 'GUI_UPLOAD'
exporting
filename = l_fname
filetype = 'ASC'
has_field_separator = '#'
tables
data_tab = lt_data
exceptions
file_open_error = 1
file_read_error = 2
no_batch = 3
gui_refuse_filetransfer = 4
invalid_type = 5
no_authority = 6
unknown_error = 7
bad_data_format = 8
header_not_allowed = 9
separator_not_allowed = 10
header_too_long = 11
unknown_dp_error = 12
access_denied = 13
dp_out_of_memory = 14
disk_full = 15
dp_timeout = 16
others = 17.
if sy-subrc <> 0.
message e000 with 'Unable to upload file from the PC'(t13).
endif.
lt_data is of same structure as the fields in the file.
For filtering duplicates:-
delete adjacent duplicates from lt_data.
Now display the records using either ALV or using write statements.
You can display the records in any of the way you want. -
Trying to recover data from old iMac CRT HD.
Problematic old iMac CRT System 9.2, Multimedia version. CD not functioning to burn data, OS freezes when attempting to copy off large amounts of data.
I tried booting this as FIREWIRE DRIVE, connecting with firewire 400 to System 10.4.11 MacBook firewire 400, (holding "T" rebooting), yet it just reboots/restarts -but not as Firewire drive.
Can I use a USP FLASH DRIVE in USP/1 port to pull out data from old Mac HD, or will System 9.2 require driver, will this work?
OR can I attach firewire 400 external formatted with System 10.4.x to this old iMac with System 9.2.x?
OR... can System 9.2.x publish/share to Macbook 10.4.11?
What do you suggest? I hate to go through added expense to have old HD physically removed, and pull data that way. THANKS< MarkUncleMarky08 wrote:
Trying to recover data from old iMac CRT HD.
Problematic old iMac CRT System 9.2, Multimedia version. CD not functioning to burn data, OS freezes when attempting to copy off large amounts of data.
This is worrisome. You may have a problem with the hard drive. I suggest you try Disk First Aid.
hd > applications > utilities
I tried booting this as FIREWIRE DRIVE, connecting with firewire 400 to System 10.4.11 MacBook firewire 400, (holding "T" rebooting), yet it just reboots/restarts -but not as Firewire drive.
this should work. You may need the latest firmware to be installed. I seem to recall that the target disk mode was added via a firmware update. Do you have a firmware password?
You need to figure out the level of your firmware before installing 10.2 or greater. ( The PC name for firmware is BIOS. ) Installing 10.2 with a down level firmware will most likely make your iMac unusable and difficult to fix.
Figuring out what level of firmware you have?
1) Mac OS 9.x or 8.x, you need to use the Apple System Profiler.
Apple -> Apple System Profiler
2) Open Firmware, boot into Open Firmware.
Power on your iMac while holding down commandoption+of
The first output line contains the firmware level. Mine reads:
Apple PowerMac4,1 4.1.9f1 BootRom built on 09/14/01 at 13.18.04
Copyright 1994-2001 Apple Computer Inc.
On my machine, I have 4.1.9f1.
What firmware do you need?
http://docs.info.apple.com/article.html?artnum=86117
For a slot loading iMac, this article indicates that you need to be running 9.1 or later version of Mac OS Classic.
http://docs.info.apple.com/article.html?artnum=75130
"The iMac Firmware Update 4.1.9 will only run on iMac computers with lot-loading CD or DVD drives running Mac OS 9.1 or later from a local drive. If you are using Mac OS X you must boot from a local Mac OS 9.1 or later writeable partition (not a CD, or network disk) prior to following the update instructions."
You can download the Mac OS 9 updates from the Apple site.
http://support.apple.com/kb/HT1387?viewlocale=en_US
Can I use a USP FLASH DRIVE in USP/1 port to pull out data from old Mac HD, or will System 9.2 require driver, will this work?
This worked for me. the driver is included in the extension folder. I was not able to format the flash drive with 9.2 drive utility. I suggest you format the flash drive to Mac OS standard.
OR can I attach firewire 400 external formatted with System 10.4.x to this old iMac with System 9.2.x?
You would need to have the latest firmware installed. otherwise, problems with the video display would occur.
OR... can System 9.2.x publish/share to Macbook 10.4.11?
you can set up an FTP server client.
I wasn't able to get apple's share working with Mac OS X 10.4.
Jan Hedlund wrote:
You may want to have a look at what Grant Bennet-Alder writes under this topic.
http://discussions.apple.com/thread.jspa?threadID=1603898&tstart=0
Jan
I was able to upload files by using an FTP server. I used PureFTPd Manager 1.7 with Mac OS X 10.4. this download does include the server software. I did have to create a FTP user. I had to boot the classic machine after configuring.
http://www.apple.com/downloads/macosx/networking_security/pureftpdmanager.html
I used fetch:
http://fetchsoftworks.com/downloads.html
I used version 3. Previously, I used version 4.
You can use any web browser to download from Mac OS X when you turn on Web sharing. This is how I downloaded fetch.
Robert
What do you suggest? I hate to go through added expense to have old HD physically removed, and pull data that way. THANKS< Mark</div> -
Charting data from text file in LabVIEW 5.1 for Windows
I am having some difficulties trying to figure out how to plot a chart with
data from a file. I would like to be able to read data from a text file
into a chart using LabVIEW 5.1 for Windows. I have looked in the help
within the program and online. I have also looked in the user manual and
the book "LabVIEW for Everyone". Could you please give me specific
instructions on how I would construct the program to be able to do this.
Thank you.Hi Ellie,
It depends on how data is stored in that txt file. Usually you load the data into an array either using or , the array if necessary and send it to the graph indicator in required form. If you want a more detailed answer, send me a sample data file ([email protected]). -
Cant get data from text file to print into Jtable
Instead of doing JDBC i am using text file as database. I cant get data from text file to print into JTable when i click find button. Goal is to find a record and print that record only, but for now i am trying to print all the records. Once i get that i will change my code to search desired record and print it. when i click the find button nothing happens. Can you please take a look at my code, dbTest() method. thanks.
void dbTest() {
DataInputStream dis = null;
String dbRecord = null;
String hold;
try {
File f = new File("customer.txt");
FileInputStream fis = new FileInputStream(f);
BufferedInputStream bis = new BufferedInputStream(fis);
dis = new DataInputStream(bis);
Vector dataVector = new Vector();
Vector headVector = new Vector(2);
Vector row = new Vector();
// read the record of the text database
while ( (dbRecord = dis.readLine()) != null) {
StringTokenizer st = new StringTokenizer(dbRecord, ",");
while (st.hasMoreTokens()) {
row.addElement(st.nextToken());
System.out.println("Inside nested loop: " + row);
System.out.println("inside loop: " + row);
dataVector.addElement(row);
System.out.println("outside loop: " + row);
headVector.addElement("Title");
headVector.addElement("Type");
dataTable = new JTable(dataVector, headVector);
dataTableScrollPane.setViewportView(dataTable);
} catch (IOException e) {
// catch io errors from FileInputStream or readLine()
System.out.println("Uh oh, got an IOException error!" + e.getMessage());
} finally {
// if the file opened okay, make sure we close it
if (dis != null) {
try {
dis.close();
} catch (IOException ioe) {
} // end if
} // end finally
} // end dbTestHere's a thread that loads a text file into a JTable:
http://forum.java.sun.com/thread.jsp?forum=57&thread=315172
And my reply in this thread shows how you can use a text file as a simple database:
http://forum.java.sun.com/thread.jsp?forum=31&thread=342380 -
Hi all,
As we can get data from .xls, .xlsx file in a dataset. Now i want to read all the entire data from .xltm file.
I also want to get all sheets name from .xltm file. I am using .Net framework 4.5, Visual studio 2012.
Please help me. I am unable to extract it. It is urgent.Hello Kalpna Bindal,
I just investigate this issue and use the following way but it does work:
private void Button_Click(object sender, RoutedEventArgs e)
// initialize connection
OleDbConnection con = new OleDbConnection();
con.ConnectionString =
"Provider=Microsoft.ACE.OLEDB.12.0;Data Source=D:\\Fruits1.xltm;Extended Properties=\"Excel 12.0 Xml;HDR=YES;\"";
//pass query to Insert values into Excel
OleDbCommand cmd = new OleDbCommand();
cmd.CommandText = "insert into [Sheet1$] values('')";
cmd.Connection = con;
// EXECUTE QUERY
con.Open();
cmd.ExecuteNonQuery();
con.Close();
I then did a research about this issue and find the following case:
http://stackoverflow.com/questions/22225017/reading-excel-xltm-files-programmatically
To test whether it is possible I use the following code in WPF:
Microsoft.Office.Interop.Excel.Application xltmApp = new Microsoft.Office.Interop.Excel.Application();
xltmApp.Visible = false;
xltmApp.ScreenUpdating = false;
Workbook xltmBook = xltmApp.Workbooks.Open(@"D:\Fruits1.xltm");
Worksheet xlworksheet = xltmBook.Worksheets.get_Item(1);
for (int i = 1; i <= 1; i++)
for(int j=1;j<=1;j++)
string str = (string)(xlworksheet.UsedRange.Cells[i, j] as Microsoft.Office.Interop.Excel.Range).Value;
MessageBox.Show(str);
The result is that I can read this .xltm file and read the firstline without problem.
I would think you can also use this way to work with your .xltm file and output it to your application.
For more details about how to fill to your WPF, common wpf and excel thread will be helpful:
http://www.codearsenal.net/2012/06/c-sharp-read-excel-and-show-in-wpf.html#.URPyfPJJocU
http://www.dotnetcurry.com/showarticle.aspx?ID=988
http://mozouna.com/Blog/2013/03/28/wpf-reading-and-writing-to-excel-file-with-c/
By the way, for WPF case please post on WPF forum instead of C# forum.Best regards,
Barry
We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
Click
HERE to participate the survey.
Maybe you are looking for
-
If I open a movie file (appears to be any type - .mov, m4v, mv4) it displays on the desktop, but when clicked, the Mac reverts to another open application (immediately UNDER to point of the mouse click) and not the displayed movie file. It appears t
-
How can I force Firefox to override javascript when opening links with ctrl+click?
There are certain sites that always open up a link in the active window despite said links being opened by ctrl+clicking it. Basically what happens is that a java script on the site forces the active window to load the link while at the same time Fir
-
There was an error downloading your purchased music. The disk could not be read from or written to. Does anyone know what this means? I purchased 2 films and cant watch them ;( I wonder if I will be charged??????
-
Hi I am looking for an alert viewer component. Does anyone have a recomendation of a commercial one? I need something that will look like "hp open view" Also.... I would like to know of a swing components package - one with it's own "sorted" tables,t
-
I've just updated and can't seem to find anyway to burn a DVD?
Ive just installed Mavericks and the latest imovie update and initially it lloks good but there doesnt appear to be any way to finalise and then burn the movie to DVD? It plays fine in theatre and there are share options to Utube, facebook, e mail et