StringTokenizer for mail merging

Righty'o
the requirements is that we have to read some data in using BufferedReader, split it using some delimiters then mix this in with a template to produce an output file.
the data to be read in is in the form
Carl%f%
Jung%l%
%n%
79 Cardgan St
Carlton%a%
Dr%t%
SD2a%s%
James%f%
..and continuing on for more people
so, I have read the information into a String and then used String Tokeniser to split it up.
using the delimiter % i get tokens like
Carl
f
Jung
l
and so on. This is fine, i can work with this
The problem i am having is that when the data between two delimiters spans two lines, such as
%n%
79 Cardgan St
Carlton%a%
StringTokenizer passes the token as
79 Cardgan StCarlton
this is not how i want it. I want the two lines to be preserved. How can i get StringTokenizer to keep the data that is spread over several lines to stay as several lines?
If i dont fix this problem, the mail merge outputs the file with the address all on one line and not over several.
Any help would be appreciated.

i set up StringTokenizer as this:
StringTokenizer dataSplitter = new StringTokenizer(theData,"%");
so you end up with tokens like
Token1: Carl
Token2: f
Toeken3: Jung
Token4: l
From what i notice, it is not using the \n character as a delimiter otherwise the different lines would be their own tokens, and this does not happen. It just seems to remove the fact that there on seperate lines.
What is the character that makes the new line? \n for new line or \r for carriage return?
One way i see to get around this, is when using readLine to read in the data, use StringTokenizer to check if there is more than one token. If there isnt, add a new line character to the end and hopefully it will be preserved in later parts.

Similar Messages

  • Can I use FileMaker as a source for mail merge in Pages

    Can I use FileMaker as a source for mail merge in Pages

    Sorry I posted this and then started reading some of the replies. I did see them as I am newbie here.
    Looks like the only solution at this time is to export the data to a csv file, open it in numbers and use the numbers file as the source for the mail merge.
    Would it be possible to have FileMaker then run an applescript ? or automator script to automatically convert the CSV file to numbers and then rename that Numbers file so that it is consistent and can be reused by the Pages "template" for subsequent documents to be used based on this template?

  • Import data from SQL Server into MS Word document for Mail Merge purpose ?

    Hi,
    Is it possible to import contacts from SQL Server into MS Word for mail merge purpose or if retrieving data from MS Excel can we update the data in MS Excel sheet without opening it ?
    Note: Remember when you open a word document already set up for mail merge, asks you to run the query to return all records from the excel sheet it is connected to.
    Khurram

    Word and the current data source dialog do not really give you any help with that.
    You either have to be able to create a View in SQL Server that performs the query you need, then connect to that, or you have to be able to create the correct query manually (or perhaps using some other query tool that can help you), then use VBA to connect
    using that query. 
    For example, if you have been through the connection process once (connecting to a single table) then you will have a .odc (Office Data Connection file) which has the info. needed to connect to the correct server and database. It's a text file with some
    HTML and XML inside. You can copy/rename it. Let's say it is called "c:\a\myodc.odc" Then in VBA you can use something like
    ActiveDocument.OpenDataSource Name:="c:\a\myodc.odc, _
    SQLStatement:="put your SQL statement in here, and if it is long,...", _
    SQLStatement1:="put the second part in here"
    You get a maximum of either 255 or around 511 characters in the SQL statement, and Word tends to impose some syntax requirements that Transact-SQL does not, so e.g. you may need to quote all your table names.
    You can also se an empty .odc file and provide connection info. in the COnnection:= parameter in OpenDataSource.
    As background, until Word 2000, by default you would use MS Query to create your SQL query, and MS Query does have facilities that can help you build your query (a bit like the ones in MS Access). That may still be possible (it is a bit harder to find the MS
    Query option now, and I am not sure it works with the latest versions of Word). MS Query only works for ODBC queries, and they do not always work correctly when you actually issue the query using ODBC from Word, because of a Word problem to do with Unicode
    fields in SQL Server. But you could probably still use MS Query to help you construct your SQL. (It's probably easier to do that in Excel, though).
    Peter Jamieson

  • Leveraging Book of Business for Mail Merge

    I'm looking for some advice from the community on how I can make use of the Book of Business for segmenting records for mail merges?
    Bascially, I want to restrict my mail merge to contain only those contacts who are linked to a specific Book of Business. Problem is I'm not quite sure how best to achieve this!
    Thanks in advance,
    Cameron

    Cameron,
    I don't believe you can get a list of records attached to a book (wish you could), you'd need to create the list based upon your rules for assigning BOB's. For example with a company i setup BOB for we assigned the books by region. So where location = north then assign to North book. Your list would then be where location= north.
    hope this helps.
    Alex

  • How do you change the default size of the print batch size for mail merge in Publisher 2010?

    I appended this question to another thread with the same topic but have not received a reply, so I'll try with a new question. Publisher 2010, when doing mail merge, will only merge and print two records at a time. How do you change the default size of
    the print batch size? This is for a 4 page document, 8 1/2 x 11, printed two sides on 11 x 17. I've tried all the suggestions that were in the other thread. The response that was marked as the answer by the moderator is incorrect and does not work. Nothing
    suggested in that thread works. A registry fix that worked for Publisher 2003 won't work because the print batch size key does not exist in the registry for Pub 2010. At least not that I can find. Printing to an XPS document doesn't work. It asks for a filename,
    prints 2 records, asks for new file name, prints 2 records, asks for new file name, and so on. The same for printing to a PDF document. Merging to a new Pub document doesn't work. When I print that job every other sheet is turned over. I.e., sheet one has
    pages 1 & 3 on top, next sheet has 3 & 4 on top, and so on. This makes it impossible to run them through the folder. The same thing happens when I print that complete merged document to XPS or PDF. I have the latest drivers installed for our printer, a Toshiba
    2500C copier/printer connected via network. What do I need to do to to change the batch size to something reasonable, like 100 records?

    It's been two weeks since I posted this question. What does it take to get an answer? I cannot believe it's being ignored, nor can I believe that someone in MS doesn't have an answer.

  • Help needed with Custom Web ADI Integrator for Mail Merge

    Hello,
    I've created a custom web adi integrator to generate letters to advise of end of probationary periods.
    The problem is that at the end of the process when the letter is opened in Word 2007, it only displays one record, and does not allow me to "preview results" and cycle through the records (this part is greyed out). It appears that the letter is not merged with the data spreadsheet although it does display one record from it.
    Our EBS version is 12.1.3 and we are using Office 2007.
    These are the steps I have followed so far (in brief):
    - Create a view to provide data (names, addresses etc).
    - Set up a new custom function (similar to seeded function HR Integrator Setup).
    - Add the custom function and other functions to Desktop Integration responsibility.
    - Add the relevant functions to end user's responsibility menu.
    - Add new category "other" to HR_ADI_DOCUMENT_TYPE lookup.
    - Create Download Excel Integrator by choosing Desktop Integration -> HR Integrator Setup. Enter "PER" for application and my view for the View Name. Upload.
    - Create another Excel document by choosing Desktop Integration -> HR Maintain Form Function Associations, and choose the integrator created above. Enter my custom function name in the generated spreadsheet and upload.
    - Define a layout for the new integrator.
    - Run the integrator under the end user responsibility and save the resulting spreadsheet, which is full of data as expected.
    - Create the letter in Word, using the saved spreadsheet as the data source for the merge. At this point the merge is successful.
    - Go to Desktop Integration -> Document Management and upload the Word mail merge document. Associate it with the custom document type created earlier.
    - Link this document to my integrator.
    - Go in as end user responsibility and run the integrator.
    At this point after enabling macros it loads 2 spreadsheets (one full of data) and the Word document, but the Word document only displays one record (approx the 10th in the list - there are about 100 in total). All of the relevant merge-related menu items on the "Mailings" tab are greyed out.
    Can anyone offer any pointers please?
    I did wonder whether it mattered if I changed the names of documents, e.g when I download and save the resulting spreadsheet full of data which I then use to merge to in the Word Doc, is it OK to call the spreadsheet anything or should it be left as the default name?
    Many thanks,
    Hazel

    Hi Nandhakumar.P,
    thanks for your response. Please find the answers below:
    - Set up a new custom function (similar to seeded function HR Integrator Setup).
    System Administrator -> Application -> Function. Query back the seeded User Function Name = "HR Integrator Setup", make a note of the details, then add a custom function entitled "NTC_HR_LETTERS" with the same details.
    - Add the custom function and other functions to Desktop Integration responsibility.
    System Administrator -> Application -> Menu. Query back User Menu Name = "Desktop Integration Menu" and add the following functions:
    WITHOUT PROMPT
    a. HR Integrator Setup
    b. HR Maintain Integrator Form Functions
    c. HR Disable Integrator
    d. HR ADI Document Overwrite Page
    e. HR ADI Document Upload Page
    f. The custom function created in previous step ("NTC_HR_LETTERS")
    WITH PROMPT
    g. HR ADI Document Management Page
    - Add the relevant functions to end user's responsibility menu.
    System Administrator -> Application -> Menu. Query back menu attached to custom responsibility of end user that will perform the action once set up.
    Add the following:
    a. The custom function "NTC_HR_LETTERS" as created previously (without prompt)
    b. Desktop Integration - Create Document (With Prompt. This function will be used to generate letters)
    - Add new category "other" to HR_ADI_DOCUMENT_TYPE lookup.
    SA_Application Developer -> Application -> Lookups -> Common. Query back Type = HR_ADI_DOCUMENT_TYPE and add a new entry entitled "Other". This document type is later assigned to the Word document I upload and link to the integrator.
    I hopoe that answers your questions.
    Regards,
    Hazel

  • No "Link" in Inspector for Mail Merge

    For doing mail merge, the turtorial says to click on Inspector, then Link ... but there is only Hyperlink. I am trying out Numbers 09. Am I doing something wrong, or does the trial version of Numbers 09 fail to have mail merge?

    The trial version if full featured. I don't know the tutorial you are watching. If you provide a link I'll see if I can figure out what it is saying. I don't think Numbers does "mail merge" by itself but it will accept data from your contacts which I believe you can then use in Pages to do a mail merge. You can also make a link within a cell that will create a new email message with the provided address, subject, and text when you click on it.

  • Label Templates for Mail Merge - Any ideas?

    Okay you guys, I want to RAPIDLY set up various label templates (as you can in WORD)  by selecting the label type ( manufacturer code) and off you go with your merging.  Problem is, I cannot find anything like that - or am I overlooking something?
    I have found how you set  up a Mail Merge field etc. But I cannot find any indicators ( even on the Help) as to where you can get label or equivalent templates... ALL help gratefully received...  even if it is staring me in the face! - I have broad shoulders!
    Here's hoping....

    Jerrold, thank you, however, it is more than just addresses, I have been used to creating all sorts of labels using logos, words etc. and "it just happened" - it sure aint at the moment!   I fear I may have to resort to Avery's on-line app and do it "in the clouds" not something I wish to do really...  I wonder what the reason is for not allowing such a core need in Pages at the moment? 
    Oh well !
    <SIGH!>

  • IPAD APP for mail merge ?

    Hi all,
    hope you can help...
    We currently go out to clients and get the information for quotations. We come back enter information such as Client, address, name, price etc into MS Excel and then mailmerge it with a template within MS word. This produces the quote and we email the pdf across to customer.
    Is there such an app for the IPAD that could do you same? I would like to pre enter the information I would know eg client, address etc... Then onsite type prices, this would then (then a templete) produce a quote which could be emailed before I leave.
    Thanks in advance for advice.
    David

    Hey,
    I know this is not a reply to your question but I just wanted to ask you about a problem I encountered while  mail merging. The steps I follow: Create a mail merge in Microsoft Word using the necessary steps ( I am pretty sure that they are correct) and  then press the  Finish & Merge button. The messages are then in my configured Outlook's outbox. The problem is that they have been in the outbox for a whole night ad not even one message got sent.
    Please reply if you kow the answer.
    Thanks.

  • AppleScript for mail merge with Excel data?

    Is there any approach for an AppleScript that lets you use Excel data as source for some kind of mail merge operations? If not, would anyone here be interested if someone (I?) would take a closer look at some kind of a (AppleScript Studio) solution for this?

    I'm not sure I get the question.
    If it is "could you use AppleScript to create mail merge for Pages with Excel?", the answer is, Yes. Both Pages and Excel are scriptable.
    If the question is "has anyone done it yet?", I don't know, but it could be a fun exercise.
    If the question is "would there be a market, if someone (you?) wrote and released such a script?", I cannot tell, but personally I would probably write a hack that worked only for my own needs - if I had them. The overhead with usability, testing, different address formats, languages, different Excel sheet formats, and so on, makes me guess that the investment wouldn't pay off for a generic solution. Especially considering both Pages and MS Office already have their own mail merge functions.

  • AppleScript for mail merge

    What is AppleScript for mail merge

    AppleScript is a programming language that is tied to certain Applications that support it. Pages v5.5.1 has a scripting dictionary of the terms it will support via AppleScript. Apple's answer to not including Mail Merge functionality in Pages v5.5.1 is for individual users to roll their own, download an example and adapt it, or use another application with built-in Mail merge features.
    See my previous post to you.

  • AppleScript support for Mail Merge

    how can I Create mail merge on new pages

    Mail Merge is not built into any version of Pages v5, as it was in Pages ’09 v4.3. Instead, one must understand AppleScript to simulate Mail Merge. Here is an example article and code.

  • "Word was unable to open the data source" error message in mail merge

    I am trying to do a mail merge in Word 2008 for Mac and receive this message when I try to open the Excel file for the data.  Can someone please help?  I tried changing the filename to .xls (originally .xlsx) but it didn't work.

    As far as I know, you cannot merge from a  .xlsx data source in Mac Word 2008, and even though there is a KnowledgeBase article at  http://support.microsoft.com/kb/2604725 that suggests
    that all you have to do is "rename" to a .xls, I think what you actually have to do is open the .xlsx in Excel and use Save As to create a .xls.
    Generally speaking, you will be better off researching Mac Word questions in the relevant forum on Microsoft Answers, in this case here: http://answers.microsoft.com/en-us/mac/forum/macoffice2008-macword
    This particular issue was discussed in this conversation: http://answers.microsoft.com/en-us/mac/forum/macoffice2008-macword/cant-open-excel-file-for-mail-merge/90ccfd11-273f-4c2a-aa37-1d859b8e41e2?page=1
    If that does not help, and you cannot find anything else in the Answers group, I suggest that you post a new question in that group, referencing the above conversation and specifying your version of Mac OSX.
    Peter Jamieson

  • Mail merge with MS Word

    I currently have an on-premise SQL server which I intend to migrate to Azure SQL database. We have a number of Word (2013) documents which pull data from the on-premise server and use for mail merge runs. However, I cannot seem to create a DataSource connection
    to perform the same operation from Azure SQL database. I have tried SQL Native Client 11.0 and various others - whilst the test connection performs correctly, no data is pulled from the table or view.

    Hi Graham,
    Did you receive any error message ? some thing like  40552 : The session has been
    terminated because of excessive transaction log space usage. etc., Please share if any to isolate the issue.
    Regards,
    Shirisha Paderu
    Disclaimer : This response contains a reference to a third party World Wide Web site. Microsoft is providing this information as a convenience to you. Microsoft does not control these sites and has not tested any software or
    information found on these sites; therefore, Microsoft cannot make any representations regarding the quality, safety, or suitability of any software or information found there. There are inherent dangers in the use of any software found on the Internet, and
    Microsoft cautions you to make sure that you completely understand the risk before retrieving any software from the Internet.

  • Problems with pages and mail merging from Address Book

    hey guys. I have just created an invitation using one of the templates in Pages. this template is for four postcard size invites on one sheet of A4. i want to merge addresses from my address book. i can do the merge except that rather than four different contacts on each page i end up with four of the same on each page before it moves on the next contact on the next page. what i want to do is for it to merge one address per postcard. in Word i would put 'next' as the last field in the merge fields but i cant find a similar command in Pages. please can some advice?

    I don't use Address Book for mail merging, but I tested this on a four page document and it worked for that so maybe it will work for your postcards. First, do your merge with full size pages and one address per page. Then in the print menu select Layout (drop down from Copies and Pages) and set it for 4 per Page (any direction you wish). That should print four different addresses on one sheet.
    Walt

Maybe you are looking for

  • 2.1 Update what is fixes and what it F's up

    Wow, I was initially amazed at the performance bump of the 2.1 update this am. After updating to Itunes 8 it sent my phone and 6 coworkers phones into bricks or partial bricks, here is the thread: "I own one Iphone, my fiance one, and my five cowoker

  • Acrobat 9 Pro settings location? [for settings backup]

    Anyone know where Acrobat 9 Pro settings are stored?  I'm on Windows 7 x64.  I want to copy my Acrobat 9 Pro settings from my current install to another system so that I don't have to reconfigure it again.  I want my Acrobat 9 Pro settings and the br

  • External monitor with external mouse and keyboard. what am I doing wrong?

    I got a iBook G3 with 600 MHz , 640 RAM, running 10.4.10. I bought a external keyboard, mouse and got a free ViewSonic Monitor from school so I hoped that I would be able to use all of these while the lid of my computer was closed. I close it, wait a

  • JDev 1013 BUG? EJB, CMR, DTO and session facade.

    I've created two CMP Entity EJB's, CourseEJB and PupilEJB, and defined a M:N relationship between them. A course has many pupils and vice versa. Each bean has only two attributes, id (Long, part of PK) and name (String) for simplicity. 1. Generated D

  • Why dose my iPod turn white when I turn it on?

    My iPod touch is not working correctly. When I turn it on it goes to the apple like it is soposed to but then goes to a whole white page. Why dose that happened?