Click here to Skip to main content
15,899,475 members
Home / Discussions / C#
   

C#

 
QuestionProgramatically adding checkboxes to datagridview Pin
deepseeindeepsy8-Jun-09 20:47
deepseeindeepsy8-Jun-09 20:47 
AnswerRe: Programatically adding checkboxes to datagridview Pin
saanj8-Jun-09 21:03
saanj8-Jun-09 21:03 
GeneralRe: Programatically adding checkboxes to datagridview Pin
deepseeindeepsy8-Jun-09 21:38
deepseeindeepsy8-Jun-09 21:38 
GeneralRe: Programatically adding checkboxes to datagridview Pin
saanj8-Jun-09 21:45
saanj8-Jun-09 21:45 
GeneralRe: Programatically adding checkboxes to datagridview Pin
deepseeindeepsy8-Jun-09 22:26
deepseeindeepsy8-Jun-09 22:26 
GeneralRe: Programatically adding checkboxes to datagridview Pin
saanj8-Jun-09 22:50
saanj8-Jun-09 22:50 
AnswerRe: Programatically adding checkboxes to datagridview Pin
Mycroft Holmes8-Jun-09 21:50
professionalMycroft Holmes8-Jun-09 21:50 
Questionnon english character problem !!! Pin
TALHAKOSEN8-Jun-09 20:45
TALHAKOSEN8-Jun-09 20:45 
(i hope i write true place)

Hi all, i use the two method shown below, to sent text as html to a word document, but non english characters arent shown in the document. what can i do??

private void button2_Click(object sender, EventArgs e)
{
WordApp = new Word.ApplicationClass();

fileName = @"........";
Microsoft.Office.Interop.Word.Document aDoc = WordApp.Documents.Open(ref fileName, ref missing, ref readOnly, ref missing, ref missing, ref missing, ref missing, ref missing, ref missing, ref Format, ref missing, ref isVisible, ref missing, ref missing, ref missing, ref missing);
WordApp.Visible = true;
bookmarkPaste(aDoc, bookmarkinWordDoc,myHtmlScript);
}


public void bookmarkPaste(Word.Document aDoc, string bookmarkAdi, string data)
{
try
{
object bookmark = bookmarkAdi;
object missing = System.Reflection.Missing.Value;
object pasteType = Word.WdPasteDataType.wdPasteHTML;
DataObject clipDO = new DataObject();

if (aDoc.Bookmarks.Exists(bookmark.ToString()))
{
Word.Range rangeTbl = aDoc.Bookmarks.get_Item(ref bookmark).Range;

clipDO.SetData(DataFormats.Html,HtmlClipboardData(data));

Clipboard.SetDataObject(clipDO, true);

rangeTbl.PasteSpecial(ref missing, ref missing, ref missing, ref missing, ref pasteType, ref missing, ref missing);
}
else
{

}
}
catch (Exception exc)
{
MessageBox.Show(exc.Message);
}
}



private static string HtmlClipboardData(string html)
{
StringBuilder sb = new StringBuilder();
Encoding encoding = Encoding.UTF8;
string Header = @"
Version: 1.0
StartHTML: {0:000000}
EndHTML: {1:000000}
StartFragment: {2:000000}
EndFragment: {3:000000}
";
string HtmlPrefix = @"
DOCTYPE HTML PUBLIC ""-//W3C//DTD HTML 4.0 Transitional//EN""&
html;
head;
meta http-equiv=Content-Type content=""text/html; charset={0}"";
/head;
body>
<!--StartFragment-->
";
HtmlPrefix = string.Format(HtmlPrefix, encoding.WebName);

string HtmlSuffix = @"
!--EndFragment--;
/body;
/html;
";

// Get lengths of chunks
int HeaderLength = encoding.GetByteCount(Header);
HeaderLength -= 16; // extra formatting characters {0:000000}
int PrefixLength = encoding.GetByteCount(HtmlPrefix);
int HtmlLength = encoding.GetByteCount(html);
int SuffixLength = encoding.GetByteCount(HtmlSuffix);

// Determine locations of chunks
int StartHtml = HeaderLength;
int StartFragment = StartHtml + PrefixLength;
int EndFragment = StartFragment + HtmlLength;
int EndHtml = EndFragment + SuffixLength;

// Build the data
sb.AppendFormat(Header, StartHtml, EndHtml, StartFragment, EndFragment);
sb.Append(HtmlPrefix);
sb.Append(html);
sb.Append(HtmlSuffix);

//Console.WriteLine(sb.ToString());
return sb.ToString();
}

thanks for everything i have...

QuestionHow to use Microsoft Enterprise Library Pin
Håkan Axheim8-Jun-09 20:21
Håkan Axheim8-Jun-09 20:21 
AnswerRe: How to use Microsoft Enterprise Library Pin
saanj8-Jun-09 20:43
saanj8-Jun-09 20:43 
Questionuser name and password Pin
Mads1158-Jun-09 20:02
Mads1158-Jun-09 20:02 
AnswerRe: user name and password Pin
Abhijit Jana8-Jun-09 20:12
professionalAbhijit Jana8-Jun-09 20:12 
GeneralRe: user name and password Pin
Mads1158-Jun-09 20:18
Mads1158-Jun-09 20:18 
GeneralRe: user name and password Pin
saanj8-Jun-09 20:25
saanj8-Jun-09 20:25 
GeneralRe: user name and password Pin
Abhijit Jana8-Jun-09 20:39
professionalAbhijit Jana8-Jun-09 20:39 
AnswerRe: user name and password Pin
saanj8-Jun-09 20:15
saanj8-Jun-09 20:15 
QuestionMulti thread, one dialog form [modified] Pin
yunusdemiray8-Jun-09 20:02
yunusdemiray8-Jun-09 20:02 
QuestionCrystal Report Problem with multiple DataTables (It is urgent) Pin
sharad Pyakurel8-Jun-09 17:15
sharad Pyakurel8-Jun-09 17:15 
QuestionError of "failed to import the activex control. please ensure it is properly registered" Pin
brandonwong1238-Jun-09 15:26
brandonwong1238-Jun-09 15:26 
AnswerRe: Error of "failed to import the activex control. please ensure it is properly registered" Pin
Christian Graus8-Jun-09 15:28
protectorChristian Graus8-Jun-09 15:28 
GeneralRe: Error of "failed to import the activex control. please ensure it is properly registered" Pin
brandonwong1238-Jun-09 18:28
brandonwong1238-Jun-09 18:28 
GeneralRe: Error of "failed to import the activex control. please ensure it is properly registered" Pin
N a v a n e e t h8-Jun-09 18:39
N a v a n e e t h8-Jun-09 18:39 
GeneralRe: Error of "failed to import the activex control. please ensure it is properly registered" Pin
brandonwong1238-Jun-09 19:01
brandonwong1238-Jun-09 19:01 
GeneralRe: Error of "failed to import the activex control. please ensure it is properly registered" Pin
Christian Graus8-Jun-09 19:02
protectorChristian Graus8-Jun-09 19:02 
GeneralRe: Error of "failed to import the activex control. please ensure it is properly registered" Pin
brandonwong1238-Jun-09 19:10
brandonwong1238-Jun-09 19:10 

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.