Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > ASP.NET and ASP > ASP.NET 1.0 and 1.1 > ASP.NET 1.0 and 1.1 Professional
Password Reminder
Register
Register | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
ASP.NET 1.0 and 1.1 Professional For advanced ASP.NET 1.x coders. Beginning-level questions will be redirected to other forums. NOT for "classic" ASP 3 or the newer ASP.NET 2.0 and 3.5
Welcome to the p2p.wrox.com Forums.

You are currently viewing the ASP.NET 1.0 and 1.1 Professional section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
 
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old May 19th, 2006, 07:24 AM
Authorized User
 
Join Date: May 2006
Location: New Delhi, Delhi, India.
Posts: 39
Thanks: 0
Thanked 0 Times in 0 Posts
Default character count of ms-word in asp.net

Hello ,

In my web Application ,I have to count character in MS-word application using Asp.net,

I have used stream like

FileStream fin;
            string s;
            char ch;
            int count=0,i;
            fin=new FileStream(@"d:\Test\test.doc",FileMode.Open);
            StreamReader fread=new StreamReader(fin);
            while((s=fread.ReadLine())!=null)
            {
                TextBox1.Text=s.ToString();
                for(i=0;i<s.Length;i++)
                {
                    ch=s[i];
                    if(ch!=0)
                        count++;
                }
            }
            fread.Close();
            ListBox1.Items.Add(count.ToString());

But this code is not working as it gives me total 1024 characters whatever characters be in actual document.
Can u give me any solution.



I have tried second way also by using com component of word as

            object filePath="d:\\Test\\test.doc";
            object readOnly=false;
            object missing=System.Reflection.Missing.Value;
            Word.ApplicationClass wa=new Word.ApplicationClass();
            Word.Document cc=wa.Documents.Open(ref filePath,
            ref missing,ref readOnly,ref missing,ref missing,ref missing,ref missing,
            ref missing,ref missing,ref missing,ref missing,ref missing);
            cc.Activate();
            int coun=cc.Characters.Count;
            cc.Close(ref missing,ref missing,ref missing);
            wa.Application.Quit(ref missing,ref missing,ref missing);



but this too is giving errors of some macro.

If u have any solution or suggestion then plz help.



rajkumar sharma
__________________
-------------------
rajkumar sharma
http://www.apnasaathi.blogspot.com
 


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
export asp.net page to ms word and embed images Itech ASP.NET 2.0 Professional 2 March 6th, 2014 03:39 AM
How to create MS Word like Callout in .NET ashu_from_india Visual Studio 2005 0 July 12th, 2007 06:48 AM
how to export data to ms word from asp.net webapp parveen_kumar24@rediffmai .NET Framework 2.0 2 August 12th, 2006 05:17 AM
ASP.NET & MS Word Napoline .NET Web Services 1 May 11th, 2004 07:09 PM



All times are GMT -4. The time now is 03:31 PM.


Powered by vBulletin®
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.