Click here to Skip to main content
15,922,696 members
Home / Discussions / C#
   

C#

 
GeneralRe: Dot-Matrix Printer Resolution Problem Pin
ismail2017-May-11 2:08
ismail2017-May-11 2:08 
AnswerRe: Dot-Matrix Printer Resolution Problem Pin
Shameel17-May-11 4:15
professionalShameel17-May-11 4:15 
QuestionExport C# Windows Datagridview to excel Pin
sumit703416-May-11 19:09
sumit703416-May-11 19:09 
AnswerRe: Export C# Windows Datagridview to excel Pin
Ravi Sant16-May-11 23:13
Ravi Sant16-May-11 23:13 
AnswerRe: Export C# Windows Datagridview to excel Pin
ambarishtv17-May-11 0:37
ambarishtv17-May-11 0:37 
QuestionReading bookmarks in word Pin
Jia10016-May-11 18:54
Jia10016-May-11 18:54 
AnswerRe: Reading bookmarks in word Pin
Ravi Sant16-May-11 23:17
Ravi Sant16-May-11 23:17 
GeneralRe: Reading bookmarks in word Pin
Jia10017-May-11 0:19
Jia10017-May-11 0:19 
Thank you Smile | :) but i am not able to goto the bookmark and bookmark names are not displayed(dont know whether i had inserted bookmarks correctly,please check).Following is the code:

Word._Application oWord;
Word._Document oDoc;
oWord = new Word.Application();
oWord.Visible = true;

object fileName = strFileName;
object readOnly = false; object isVisible = true;
object missing = System.Reflection.Missing.Value;
object oEndOfDoc = "\\endofdoc";
oDoc = oWord.Documents.Open(ref fileName, ref missing, ref readOnly, ref missing, ref missing, ref missing, ref missing, ref missing, ref missing, ref missing, ref missing, ref isVisible, ref missing, ref missing, ref missing, ref missing);
oDoc.Activate();

Word.Paragraph oPara1;
oPara1 = oDoc.Content.Paragraphs.Add(ref missing);
oPara1.Range.Text = "Heading 1";
oPara1.Range.Font.Bold = 1;
oPara1.Format.SpaceAfter = 24;
oPara1.Range.InsertParagraphAfter();
Word.Paragraph oPara2;
object oRng = oDoc.Bookmarks.get_Item(ref oEndOfDoc).Range;
oPara2 = oDoc.Content.Paragraphs.Add(ref oRng);
oPara2.Range.Text = "Heading 2";
oPara2.Format.SpaceAfter = 6;
oPara2.Range.InsertParagraphAfter();

Word.Paragraph oPara3;
oRng = oDoc.Bookmarks.get_Item(ref oEndOfDoc).Range;
oPara3 = oDoc.Content.Paragraphs.Add(ref oRng);
oPara3.Range.Text = "This is a sentence of normal text.Now here is a text";
oPara3.Range.Font.Bold = 0;
oPara3.Format.SpaceAfter = 24;
oPara3.Range.InsertParagraphAfter();

oDoc.Paragraphs[1].Range.InsertParagraphBefore();
object bm1 = oDoc.Paragraphs[1].Range;
Microsoft.Office.Interop.Word.Bookmark bookmark1 = oDoc.Bookmarks.Add("bookmark1", ref bm1);
bookmark1.Range.Text = "bm1";

oDoc.Paragraphs[2].Range.InsertParagraphBefore();
object bm2 = oDoc.Paragraphs[2].Range;
Microsoft.Office.Interop.Word.Bookmark bookmark2 = oDoc.Bookmarks.Add("bookmark2", ref bm2);
bookmark1.Range.Text = "bm2";


int nCount;
nCount = oDoc.Bookmarks.Count;

for (int i = 0; i < nCount; i++)
{
object objI = i;
MessageBox.Show(oDoc.Bookmarks.get_Item(ref objI).Name);
}

modified on Tuesday, May 17, 2011 7:07 AM

QuestionFlex UI .Net windows form in C# Pin
Thilina C16-May-11 17:36
Thilina C16-May-11 17:36 
AnswerRe: Flex UI .Net windows form in C# Pin
AspDotNetDev16-May-11 17:48
protectorAspDotNetDev16-May-11 17:48 
GeneralRe: Flex UI .Net windows form in C# Pin
Thilina C16-May-11 19:55
Thilina C16-May-11 19:55 
AnswerRe: Flex UI .Net windows form in C# Pin
BobJanova16-May-11 22:29
BobJanova16-May-11 22:29 
AnswerRe: Flex UI .Net windows form in C# Pin
0bx31-May-11 3:46
0bx31-May-11 3:46 
QuestionRealTime Pin
arkiboys16-May-11 9:27
arkiboys16-May-11 9:27 
AnswerRe: RealTime Pin
Ian Shlasko16-May-11 9:40
Ian Shlasko16-May-11 9:40 
GeneralRe: RealTime Pin
arkiboys16-May-11 9:58
arkiboys16-May-11 9:58 
GeneralRe: RealTime Pin
Keith Barrow16-May-11 10:25
professionalKeith Barrow16-May-11 10:25 
AnswerRe: RealTime [modified] Pin
dan!sh 16-May-11 10:28
professional dan!sh 16-May-11 10:28 
GeneralRe: RealTime Pin
Keith Barrow16-May-11 10:56
professionalKeith Barrow16-May-11 10:56 
GeneralRe: RealTime Pin
dan!sh 16-May-11 11:04
professional dan!sh 16-May-11 11:04 
AnswerRe: RealTime Pin
AspDotNetDev16-May-11 10:30
protectorAspDotNetDev16-May-11 10:30 
AnswerRe: RealTime Pin
Luc Pattyn16-May-11 12:10
sitebuilderLuc Pattyn16-May-11 12:10 
QuestionThreadPool don't work Pin
abbd16-May-11 5:24
abbd16-May-11 5:24 
AnswerRe: ThreadPool don't work Pin
Pete O'Hanlon16-May-11 5:46
mvePete O'Hanlon16-May-11 5:46 
QuestionRe: ThreadPool don't work Pin
abbd16-May-11 5:55
abbd16-May-11 5:55 

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.