C# - String Replacements For Word Merge

Mar 31, 2011

using asp.net 4 we do a lot of Word merges at work. rather than using the complicated conditional statements of Word i want to embed my own syntax. something like:

Dear Mr. { select lastname from users where userid = 7 },
Your invoice for this quarter is: ${ select amount from invoices where userid = 7 }.......

ideally, i'd like this to get turned into: string.Format("Dear Mr. {0}, Your invoice for this quarter is: ${1}", sqlEval[0], sqlEval[1]);

View 4 Replies


Similar Messages:

C# - Word Mail Merge From Web Application

Aug 12, 2010

What is the best way to do this. I dont have access to the database since it is firewalled. It needs to be done throught the web interface. I can generate a csv file and plug it into the word document, but it seems cumbersome to me. Is there any better way to do this?

View 1 Replies

C# - Word Mail Merge For Server

Sep 9, 2010

Need to do a mail merge for ASP.NET application. Considered just programatically using word directly but this has liscening implications and is not recommended [URL] So was looking into openXML / Word Automation Services. But not sure if can easily achieve a mail merge via this?

View 1 Replies

Web Forms :: Word Mail Merge On A Web Page Using C# .Net

Feb 17, 2010

I have all the data in excel/or some of database which has forexample to and from email addresses,names etc. I need to Mail Merge data into Word Document and this word document should be editable for any additions or modifications. Need to have the ability to type in the text or attach an attachment. should be filled with all the To,CC,subject fields from database/excel sheet and send an email. I need all this on a web page so i can distribute this webpage url to the user and he can get all this.

Is there any way to do this and if some one provide me some links to work on this or send me some code for this. I really donot have any idea and need to start from starch on how to accomplish this task.

View 14 Replies

Merge Word Documents (Office Interop & .NET) - Keep Formatting

Mar 25, 2010

I'm having some difficulty merging multiple word documents together using Microsoft Office Interop Assemblies (Office 2007) and ASP.NET 3.5. I'm able to merge the documents, but some of my formatting is missing (namely the fonts and images). My current merge code is shown below.

private void CombineDocuments() {
object wdPageBreak = 7;
object wdStory = 6;
object oMissing = System.Reflection.Missing.Value;
object oFalse = false;
object oTrue = true;
string fileDirectory = @"C:documents";
Microsoft.Office.Interop.Word.Application WordApp = new Microsoft.Office.Interop.Word.Application();
Microsoft.Office.Interop.Word.Document wDoc = WordApp.Documents.Add(ref oMissing, ref oMissing, ref oMissing, ref oMissing);
string[] wordFiles = Directory.GetFiles(fileDirectory, "*.doc");
for (int i = 0; i < wordFiles.Length; i++) {
string file = wordFiles[i];
wDoc.Application.Selection.Range.InsertFile(file, ref oMissing, ref oMissing, ref oMissing, ref oFalse);
wDoc.Application.Selection.Range.InsertBreak(ref wdPageBreak);
wDoc.Application.Selection.EndKey(ref wdStory, ref oMissing);
}
string combineDocName = Path.Combine(fileDirectory, "Merged Document.doc");
if (File.Exists(combineDocName))
File.Delete(combineDocName);
object combineDocNameObj = combineDocName;
wDoc.SaveAs(ref combineDocNameObj, ref m_WordDocumentType, ref oMissing, ref oMissing, ref oMissing, ref oMissing, ref oMissing, ref oMissing, ref oMissing, ref oMissing, ref oMissing, ref oMissing, ref oMissing, ref oMissing, ref oMissing, ref oMissing);
}

I don't care necessarily how this is accomplished. It could output via PDF if it had to. I just want the formatting to carry over.

View 1 Replies

VS 2008 - Create Mail Merge Doc Using MS Word 2003/2007?

Apr 13, 2010

I need to create some mail merge documents and was wondering if anyone knew the best way of doing this from asp.net. Currently I have set up .dot template files with bookmarks and then use COM to open these files pass the data and save. I can then stream the file to the users desktop. The issue i have is that to get this working when i release it is by installing Wrord on the server which I would prefer not to do.

way of passing data to word docs and then opening them to the user. The reason why i need to use word, is that the user needs to be able to modify the doc.

View 7 Replies

Architecture :: Make Application Work With Ms Word Mail Merge?

Nov 9, 2010

I am planning to create HR Management System using asp.net & sql server 2005. In this application we need to manage different kinds of Employee Documents like Offer letter,Salary certificate etc.. Now,What we need is we will store templates for these documents(ms word,excel) in the application and needs to genereate these documets corresponding to the selected employee like mail merge.

View 3 Replies

What Are Classic Ado's Recordset Replacements

Mar 15, 2011

I've tried to do my homework on this...

I'm migrating a site from classic asp to asp.net 4.0

Before I rework all the code, I wanted to get clarification that the way i think my database code should be updated is fairly correct. (I'm using SQLClient objects)

First, when old code would use forward only recordsets or access single record/value, I'm fairly sure i'd use SqlCommand and SqlDataReader. That is pretty straightforward.

Now, when my old code navigates a recordset (movePrevious, find, etc.)... I believe the way to go is with SqlDataAdapter and DataTable to retrieve the data and DataView to filter/find/navigate the data.

I'n looking to do a quick migration... i don't want to get too bogged down in the new entity framework... so - just trying to stick with similar objects/logic.

I know this is one of those questions that doesn't really have a right/wrong answer... and I think that is part of my problem in finding an answer - there are so many.

View 2 Replies

Multiple Regex Replacements In C#?

Nov 10, 2010

I am trying create a Regex-based replacement for an article to automatically convert embedded references (many of them) in posts into the appropriate link and title format.

For example, given this:

I have already blogged about this topic ((MY TOPIC ID: "2324" "a number of times")) before. And I have also covered ((MY TOPIC ID: "777" "similar topics")) in the past.

... I want to get this:

I have already blogged about this topic <a href='/post/2324'>a number of times</a> before. And I have also covered <a href='/post/777'>similar topics</a> in the past.

I currently have this:

/* Does not work */
public static string ReplaceArticleTextWithProductLinks(string input)
{
string pattern = "\(\(MY TOPIC ID: \".*?\" \".*?\"\)\)";
string replacement = "<a href='/post/$1'>$2</a>";
return Regex.Replace(input, pattern, replacement);
}

But it seems to return lines that contain <a href='/post/'></a> without appending matches instead of $1 and $2.

Question: What is the easiest way to do convert the string #1 above to string #2 above?

View 1 Replies

Remove Html & Some Other Unusual Word From String

Jan 9, 2010

i have a problem in Mysql then when i execute our query he not execute because some html code included in query like amp; it; & some other how to encode or any other sollution to solve this problem

View 10 Replies

Controls :: How To Remove Specific Word From String

May 7, 2015

Rs100 - Rs300

Rs5000 - Rs60000

I want to remove Rs how will be remove Rs using substring? 

View 1 Replies

Web Forms :: Export XML String To Excel Or Word

Aug 9, 2012

I am having a html page.

I can able to read the html page and store in a string variable.

I need to convert this string to xml and export to excel or word.

View 1 Replies

Count How Many Times Each Word Occurs In Array Or String

Aug 4, 2010

I would like to know if someone can give me a good example of counting how many times each word is occuring in a string and then show the results

I have one example and I thought it worked well ......but as soon as a word appear more then twice it thows an error....so this code is not really working then

below is the code I have anyway...maybe someone can tweak it for me if possible.

[code]....

View 2 Replies

Security :: Split The String Of MembershipCreateStatus To Multi-word?

Apr 7, 2010

I hope to convert MembershipCreateStatus to a string, but I hope to split the string to multi-word by upper case, such as "InvalidUserName"=>"Invalid User Name", how can I do?

Now I use a complex way.

MembershipCreateStatus status;
Membership.CreateUser(userName, password, email, question, answer, true, out status);
string s="";
switch (status)
{
case MembershipCreateStatus.Success:
s="Success"
break;
case MembershipCreateStatus.DuplicateUserName:
s="Duplicate User Name"
break;
case MembershipCreateStatus.InvalidUserName:
s="Invalid User Name"
break;
case MembershipCreateStatus.DuplicateEmail:
s="Invalid User Name"
break;
}

View 1 Replies

Web Forms :: Split String Word Into Alphabet Characters Using C#

Jun 1, 2013

How to split word like "Software" into alphabet like it should return me "s" "o" "f" "t" "w" "a" "r" "e" on webform.

This word is save into sql server database and i want to retreive the word and show it into alphabet with space.

View 1 Replies

SQL Server :: Full Text Search In A Word Document - How To Highlight The String

Aug 17, 2010

I´m currently programming a web search application in ASP.Net and having problem with full text searching. My requirements are:

1. Save a byte array from SQL server to word document as a temp file in a server side?

2. How to highlight the string I am currently searching in the Word document and return to the user the sentence with the highlighted string (like on Bing or any other search engines)? Is it possible to fullfill this requirement with full-text search integrated in SQL Server 2008?

View 1 Replies

String Was Not Recognized As A Valid DateTime / Unknown Word Starting At Index 0?

Mar 25, 2011

I got an error:

The string was not recognized as a valid DateTime. There is a unknown word starting at index 0

View 1 Replies

Localization :: Users To Be Able To Enter An English Word Or A Korean Word In Each Respective Textboxes?

Mar 4, 2010

I have a page with two textboxes (one for english and one for korean)..

I want users to be able to enter an english word or enter a korean word in each respective textboxes...

Now I can only enter english in both of them... Even if my keyboard language is switched to Korean(I have the language pack installed).. I can not type in Korean in the Korean text box....

I thought I could simply change this using something like:

[Code]....

View 1 Replies

Controls :: Automatically Replace Word In TextBox With Word In Database On Button Click

May 7, 2015

I have text box and submit button in my page and I have 2 table 1- WORD table   2-name table in database

when I click on submit button it insert textbox.text in database in Name table

I define some word in my word table like:

Bad
Worst
badly and other words

Now I want if users enter word's that is in Word table when they click on submit button it replace that word with this word-->"GOOD"

How I can do it?

View 1 Replies

Msword - Convert Word 2007 Document To Word 2003 Programmatically ?

Apr 15, 2010

any component or library (preferably open source) that would allow me to convert Word 2007 documents to Word 2003 with ASP.NET?

View 3 Replies

Forms Data Controls :: Export Gridview To Word Doc Using Existing Word Doc?

Mar 25, 2011

I want export gridview data to existing word doc. The word doc is avaliable in my pc.

Is it possible to export data?

View 4 Replies

Controls :: Read And Import MS Word Document To Database Using Microsoft Interop Word Library

Feb 25, 2016

I have QuestionTable.

ID Question Answer1 Answer2 Answer3 Answer4

But I want import from MS Word into table. I have question like this:

Question:   @1.The capital of India.

 Answer:$A) Dushanbe;$B) Moscow;$C) Delhi;$D) Kabul;

@2.The capital of Tajikistan.

$A) Dushanbe;$B) Moscow;$C) Delhi;$D) Kabul;

@3.The capital of Afganistan.

$A) Dushanbe;$B) Moscow;$C) Delhi;$D) Kabul;

Output result:

ID Question Answer1 Answer2 Answer3 Answer4

1 1.The capital of India. A) Dushanbe; B) Moscow; C) Delhi; D) Kabul;

View 1 Replies

Using Microsoft.Office.Interop.Word To Convert Uploaded Word Documents Into Previewable Html Files?

Feb 3, 2010

I'm hoping this is an easy one...I'm using Microsoft.Office.Interop.Word to convert uploaded word documents into previewable html files. I haven't implemented it fully, but I've played around with it enough that I think I have a plan that will work... My question revolves around

[Code]....

I'm not in love with the idea of opening word and closing it everytime there's an upload (which I hope is a lot of the time) I'd like to make this a shared object that loads at application start. I have 2 questions
that go along with this. 1. I imagine that winword could lock up and that would be a problem, right? 2. to save a document I use wordapp.ActiveDocument, this could have an issue as a shared object, right? I think I'm talking myself right out of this...

View 1 Replies

MS Word Mailmerge Like Functionality To Allow Export To Word Document From Web Application?

Jul 5, 2010

I have requirement where I need to allow users to upload a Word document with place holders for certain fields which can be found in the database. This will be their template. For example the place holders might be prepended with @@ or something. For example

Dear @@Title @@Lastname

They then can grab a record and hit export to Word document. This will then let them choose the template. They can select the template and then click continue. I will then get the template and replace the @@Title with the title field in the database for the selected record. I am not sure where to start or what components I need to do this.

From my initial investigation it seems that I can do this with the new open XML standard for Office 2007. So perhaps I should read in the template and save all the contents to a db table somewhere. Then when the use wants to export I get the contents again and then do a search and replace for the @@ placeholders and link them properly. Then save the document to the output stream again which will then bring up the save dialog on their browser.

I am using ASP.Net MVC and am in a hosted environment. I was also maybe contemplating dynamically creating a new View type and dynamically creating new views when the user uploads a template. Not sure that this approach will work though.

View 2 Replies

Web Forms :: Open Word Document In Word Program Not In Browser

Jan 11, 2011

I have a word document which opens in a web browser using ASP.NET 2.0 this is the code:

[Code]....

THIS WORKS, PROMPTING THE USER WITH "OPEN" "SAVE" "CANCEL" OR SOME USERS WITH "SAVE" "CANCEL" DEPENDING ON USER INTERNET SECURITY SETTING. BUT FOR SECURITY ISSUES, MY BOSS WANT THIS WORD DOCUMENT TO BE OPENED IN WORD PROGRAM. (MICROSOFT WORD 93,97 ETC) IS THIS POSSIBLE....? OFCOURSE SAVING THE FILE IS OKAY, JUST OPENING THE DOCUMENT SHOULD BE NOT BROWSER.

View 3 Replies







Copyrights 2005-15 www.BigResource.com, All rights reserved