Click here to Skip to main content
15,883,127 members
Home / Discussions / COM
   

COM

 
QuestionHelp with serial scanner to PC connection? Pin
TonyTrokodero26-Mar-09 9:05
TonyTrokodero26-Mar-09 9:05 
AnswerRe: Help with serial scanner to PC connection? Pin
«_Superman_»28-Mar-09 18:23
professional«_Superman_»28-Mar-09 18:23 
QuestionActiveX in IE Pin
Member 471608725-Mar-09 20:54
Member 471608725-Mar-09 20:54 
QuestionAsserting in afxwin1.inl Line: 29 Pin
vibindia24-Mar-09 20:57
vibindia24-Mar-09 20:57 
AnswerAlmost impossible to tell Pin
Baltoro29-Mar-09 10:55
Baltoro29-Mar-09 10:55 
QuestionCustomize context menu of Outlook Express Pin
Crazy Kiya re24-Mar-09 18:05
Crazy Kiya re24-Mar-09 18:05 
QuestionProblem calling C++ DLL from Excel Pin
gvanto24-Mar-09 16:10
gvanto24-Mar-09 16:10 
QuestionError Pin
boy_16097824-Mar-09 7:54
boy_16097824-Mar-09 7:54 
when I am Loading the EXE file I am getting this error. How can I rectiy this
error
Could not load file or assembly 'Microsoft.Office.Interop.Word, Version=11.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c' or one of its dependencies. The system cannot find the file specified.

Here is the Code Below

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using System.Text.RegularExpressions;
using System.IO;
using Microsoft.Office.Interop.Word;

namespace WordCheckPercent
{
public partial class Form1 : Form
{
Match m;
Regex r;
FileStream fsr;
FileStream fsw;
StreamReader sr;
StreamWriter sw;

public Form1()
{
InitializeComponent();
}

private void button1_Click(object sender, EventArgs e)
{

button1.Enabled = false;
button2.Enabled = false;
File.Delete("c:\\tmp.txt");
File.Delete("c:\\tmp1.txt");
//Word.Application app = new Word.ApplicationClass();
Microsoft.Office.Interop.Word.ApplicationClass app = new Microsoft.Office.Interop.Word.ApplicationClass();
object nullobj = System.Reflection.Missing.Value;
string docpath = "";
foreach(string str in Directory.GetFiles(textBox1.Text))
{
if((str.EndsWith(".doc"))||(str.EndsWith(".rtf")))
{
docpath=str;
break;
}
}
object file =docpath;
Microsoft.Office.Interop.Word.Document doc = app.Documents.Open
(ref file, ref nullobj, ref nullobj, ref nullobj,
ref nullobj, ref nullobj, ref nullobj, ref nullobj,
ref nullobj, ref nullobj, ref nullobj, ref nullobj,
ref nullobj, ref nullobj, ref nullobj, ref nullobj);
doc.ActiveWindow.Selection.WholeStory();
doc.ActiveWindow.Selection.Copy();
IDataObject data = Clipboard.GetDataObject();
// string text = data.GetData(DataFormats.Text).ToString();
//string text = data.GetData(DataFormats.Text).ToString();
string text = data.GetData(DataFormats.Text).ToString();
// MessageBox.Show(text);
doc.Close(ref nullobj, ref nullobj, ref nullobj);
app.Quit(ref nullobj, ref nullobj, ref nullobj);
fsw=new FileStream("c:\\tmp.txt",FileMode.Create,FileAccess.Write);
sw=new StreamWriter(fsw);
sw.Write(text);
sw.Close();fsw.Close();
fsr = new FileStream("c:\\tmp.txt", FileMode.Open, FileAccess.Read);
sr = new StreamReader(fsr);
string line = sr.ReadToEnd();
line = Regex.Replace(line, " ", "\r\n");
line = Regex.Replace(line, @"([\r\n]+)", "\r\n");
sr.Close(); fsr.Close();
fsw = new FileStream("c:\\tmp1.txt", FileMode.Create, FileAccess.Write);
sw = new StreamWriter(fsw);
sw.Write(line);
sw.Close(); fsw.Close();
fsr = new FileStream("c:\\tmp1.txt", FileMode.Open, FileAccess.Read);
sr = new StreamReader(fsr);
int countdoc = 0;
while ((line = sr.ReadLine()) != null)
{
if (line != "")
{
countdoc = countdoc + 1;
}
// MessageBox.Show(line);
}
sr.Close(); fsr.Close();
MessageBox.Show("Source file Word count :- "+countdoc.ToString());
////////////////////////////////////////////////////////////

progressBar1.Visible = true;
this.progressBar1.Maximum = countdoc;
this.progressBar1.Minimum = 0;
this.progressBar1.Step = 1;

File.Delete(textBox1.Text + "\\error.txt");
fsr = new FileStream("c:\\tmp1.txt", FileMode.Open, FileAccess.Read);
sr = new StreamReader(fsr);
bool status = false;
Microsoft.Office.Interop.Word.ApplicationClass winword = new Microsoft.Office.Interop.Word.ApplicationClass();
Object o = System.Reflection.Missing.Value;
while ((line = sr.ReadLine()) != null)
{
m = Regex.Match(line, @"([a-z])([^a-z])([a-z])", RegexOptions.IgnoreCase);
if (m.Success)
{
}
else
{
line = Regex.Replace(line, @"([a-z])([^a-z])", "$1", RegexOptions.IgnoreCase);
line = Regex.Replace(line, @"([^a-z])([a-z])", "$2", RegexOptions.IgnoreCase);
}
status = winword.CheckSpelling(line, ref o, ref o, ref o, ref o, ref o, ref o, ref o, ref o, ref o, ref o, ref o, ref o);
if (line.Length == 1)
{
if ((line == "i") || (line == "I") || (line == "a") || (line == "A"))
{
status = true;
line = " " + line + " ";
}
else
{
m = Regex.Match(line, @"[a-z]", RegexOptions.IgnoreCase);
if (m.Success)
{
status = false;
line = " " + line + " ";
}
else
{
status = true;

}
}
}
if (status == false)
{
fsw = new FileStream(textBox1.Text + "\\error.txt", FileMode.Append, FileAccess.Write);
sw = new StreamWriter(fsw);
sw.WriteLine(line);
sw.Close(); fsw.Close();
}
progressBar1.PerformStep();
}
winword.Quit(ref nullobj, ref nullobj, ref nullobj);
progressBar1.Visible = false;

////////////////////////////////////

int counttxt = 0;
fsr = new FileStream(textBox1.Text + "\\error.txt", FileMode.Open, FileAccess.Read);
sr = new StreamReader(fsr);
while ((line = sr.ReadLine()) != null)
{
if (line != "")
{
counttxt = counttxt + 1;
}
}
sr.Close(); fsr.Close();
MessageBox.Show("Total Error count:- "+counttxt.ToString());

fsw = new FileStream(textBox1.Text+"\\DataAccuracy.txt", FileMode.Create, FileAccess.Write);
sw = new StreamWriter(fsw);
double mu=(counttxt*100);
double final=100-(mu/countdoc);
int ab = docpath.LastIndexOf("\\");
string filnam = docpath.Substring(ab + 1);
sw.WriteLine("###########################" + filnam + "###########################");
sw.WriteLine("\r\n\r\n");
sw.WriteLine("Source file Word count :- " + countdoc);
sw.WriteLine();
sw.WriteLine("Total Error count:- " + counttxt);
sw.WriteLine();
sw.WriteLine("Data Accuracy for given file is :- "+final+"%");
sw.Close(); fsw.Close();

this.Close();
File.Delete("c:\\tmp.txt");
// File.Delete("c:\\tmp1.txt");
}
private void button2_Click(object sender, EventArgs e)
{
if (this.folderBrowserDialog1.ShowDialog() == DialogResult.OK)
this.textBox1.Text = this.folderBrowserDialog1.SelectedPath;
}
}
}
AnswerWrong Forum Pin
Baltoro29-Mar-09 10:36
Baltoro29-Mar-09 10:36 
QuestionAccess method of COM components through ASP gives error Pin
Member 259548824-Mar-09 2:04
Member 259548824-Mar-09 2:04 
QuestionHow should I declare jagged arrays to expose them to VB6/VBScript?? Pin
Martha Jamer23-Mar-09 13:02
Martha Jamer23-Mar-09 13:02 
AnswerRe: How should I declare jagged arrays to expose them to VB6/VBScript?? [modified] Pin
Vi224-Mar-09 23:16
Vi224-Mar-09 23:16 
QuestionOffice12 COM addin question Pin
MumbleB20-Mar-09 6:55
MumbleB20-Mar-09 6:55 
AnswerRe: Office12 COM addin question Pin
Baltoro21-Mar-09 8:19
Baltoro21-Mar-09 8:19 
GeneralRe: Office12 COM addin question Pin
MumbleB24-Mar-09 2:32
MumbleB24-Mar-09 2:32 
GeneralRe: Office12 COM addin question Pin
Baltoro27-Mar-09 6:03
Baltoro27-Mar-09 6:03 
Questionproblem in implementing security on contact smartcard in VC++6 Pin
aditi kauts20-Mar-09 0:23
aditi kauts20-Mar-09 0:23 
AnswerRe: problem in implementing security on contact smartcard in VC++6 Pin
ray_rash2-Jul-09 23:37
ray_rash2-Jul-09 23:37 
Questionbutton image in activex Pin
aysl18-Mar-09 9:41
aysl18-Mar-09 9:41 
AnswerRe: button image in activex Pin
Jonathan Davies19-Mar-09 1:23
Jonathan Davies19-Mar-09 1:23 
GeneralRe: button image in activex Pin
aysl19-Mar-09 2:46
aysl19-Mar-09 2:46 
GeneralRe: button image in activex Pin
Jonathan Davies19-Mar-09 3:08
Jonathan Davies19-Mar-09 3:08 
GeneralRe: button image in activex Pin
aysl19-Mar-09 3:27
aysl19-Mar-09 3:27 
GeneralRe: button image in activex Pin
Jonathan Davies19-Mar-09 4:13
Jonathan Davies19-Mar-09 4:13 
GeneralRe: button image in activex Pin
aysl19-Mar-09 4:50
aysl19-Mar-09 4:50 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.