Click here to Skip to main content
15,887,135 members
Home / Discussions / C#
   

C#

 
GeneralRe: C# Excel- Paste HTML table in excel sheet Pin
Richard MacCutchan17-May-13 1:37
mveRichard MacCutchan17-May-13 1:37 
GeneralRe: C# Excel- Paste HTML table in excel sheet Pin
raesark17-May-13 1:46
raesark17-May-13 1:46 
GeneralRe: C# Excel- Paste HTML table in excel sheet Pin
Eduardo Antonio Cecilio Fernandes17-May-13 2:00
Eduardo Antonio Cecilio Fernandes17-May-13 2:00 
GeneralRe: C# Excel- Paste HTML table in excel sheet Pin
Richard MacCutchan17-May-13 2:20
mveRichard MacCutchan17-May-13 2:20 
GeneralRe: C# Excel- Paste HTML table in excel sheet Pin
raesark17-May-13 2:29
raesark17-May-13 2:29 
GeneralRe: C# Excel- Paste HTML table in excel sheet Pin
Richard MacCutchan17-May-13 3:00
mveRichard MacCutchan17-May-13 3:00 
GeneralRe: C# Excel- Paste HTML table in excel sheet Pin
raesark17-May-13 3:10
raesark17-May-13 3:10 
Questionreplace a Text in winword within a range Pin
Cyrus-IRA16-May-13 20:38
Cyrus-IRA16-May-13 20:38 
...
[START]
blaaa blaa blaa
T h i s
(this is an empty line)
{END]
...
another line
--------------------------------------
I have been trying to remove empty lines appearing between
[START] and {END] within a word document.
Code seems to work if I did not have a textbox at top of my document. It seems that the textbox is also cleared once such operation takes place.
wordapp = new Word.Application();
wordapp.Visible = false;
doc = wordapp.Documents.Open(wordPath);
paragraphs = doc.Paragraphs;
bool flag = false;

foreach (Word.Paragraph paragraph in paragraphs)
{
    string s = paragraph.Range.Text;
    string y = paragraph.Range.Text.Trim();

    if (paragraph.Range.Text == "<NE>\r")
    {
        flag = true;
        paragraph.Range.Select();
        wordapp.Selection.Delete();
        continue;

    }
    else if (paragraph.Range.Text == "</NE>\r")
    {
        flag = false;
        paragraph.Range.Select();
        wordapp.Selection.Delete();
        continue;
    }
    else if (paragraph.Range.Text.Trim() == string.Empty )
    {
        if (flag)
        {
            paragraph.Range.Select();
            wordapp.Selection.Delete();
        }
        continue;
    }

}

// Save the document and close document
doc.Save();
// Quit the word application
wordapp.Quit();


is there any other way to achieve what I do using Range in Word or dealing with a textbox in Word?

Student of life

AnswerRe: replace a Text in winword within a range Pin
BillWoodruff16-May-13 21:38
professionalBillWoodruff16-May-13 21:38 
QuestionHow to verify the signature signed by Java? Pin
Jun Du16-May-13 11:16
Jun Du16-May-13 11:16 
AnswerRe: How to verify the signature signed by Java? Pin
Abhinav S16-May-13 16:50
Abhinav S16-May-13 16:50 
QuestionAtomicity in C# Pin
gggustafson16-May-13 9:14
mvagggustafson16-May-13 9:14 
AnswerRe: Atomicity in C# Pin
dusty_dex16-May-13 9:30
dusty_dex16-May-13 9:30 
SuggestionRe: Atomicity in C# Pin
Matt T Heffron16-May-13 9:44
professionalMatt T Heffron16-May-13 9:44 
GeneralRe: Atomicity in C# Pin
dusty_dex16-May-13 10:15
dusty_dex16-May-13 10:15 
GeneralRe: Atomicity in C# Pin
gggustafson16-May-13 11:43
mvagggustafson16-May-13 11:43 
QuestionRe: Atomicity in C# Pin
Matt T Heffron16-May-13 10:34
professionalMatt T Heffron16-May-13 10:34 
AnswerRe: Atomicity in C# Pin
gggustafson16-May-13 11:45
mvagggustafson16-May-13 11:45 
AnswerRe: Atomicity in C# Pin
Matt T Heffron16-May-13 12:05
professionalMatt T Heffron16-May-13 12:05 
GeneralRe: Atomicity in C# Pin
gggustafson17-May-13 5:32
mvagggustafson17-May-13 5:32 
GeneralRe: Atomicity in C# Pin
Dave Kreskowiak17-May-13 7:49
mveDave Kreskowiak17-May-13 7:49 
GeneralRe: Atomicity in C# Pin
gggustafson17-May-13 7:59
mvagggustafson17-May-13 7:59 
GeneralRe: Atomicity in C# Pin
Dave Kreskowiak17-May-13 9:40
mveDave Kreskowiak17-May-13 9:40 
GeneralRe: Atomicity in C# Pin
gggustafson17-May-13 10:11
mvagggustafson17-May-13 10:11 
AnswerRe: Atomicity in C# Pin
AspDotNetDev16-May-13 12:02
protectorAspDotNetDev16-May-13 12:02 

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.