Click here to Skip to main content
15,902,939 members
Home / Discussions / C#
   

C#

 
GeneralRe: Http 407 error code Pin
George_George22-Sep-08 22:54
George_George22-Sep-08 22:54 
GeneralRe: Http 407 error code Pin
N a v a n e e t h22-Sep-08 23:00
N a v a n e e t h22-Sep-08 23:00 
GeneralRe: Http 407 error code Pin
George_George22-Sep-08 23:16
George_George22-Sep-08 23:16 
GeneralRe: Http 407 error code Pin
N a v a n e e t h22-Sep-08 23:45
N a v a n e e t h22-Sep-08 23:45 
GeneralRe: Http 407 error code Pin
George_George22-Sep-08 23:53
George_George22-Sep-08 23:53 
QuestionHow to force Word to open doc in Print Layout View? Pin
Julia122-Sep-08 21:50
Julia122-Sep-08 21:50 
AnswerRe: How to force Word to open doc in Print Layout View? Pin
Pete O'Hanlon22-Sep-08 21:54
mvePete O'Hanlon22-Sep-08 21:54 
GeneralRe: How to force Word to open doc in Print Layout View? Pin
Julia123-Sep-08 0:06
Julia123-Sep-08 0:06 
Thanks a lot for your quick answer,

Actually I have encountered several problems working with Word.
Please see if you can help me resolve them.

My application creates documents (Microsoft.Interop.Word.Document) each one according to another template(.dot on the hard disc). Then I have to merge them and save as a single .doc (while the original formatting is saved). I do this in the following way:
///////////////
Range rangeTrg = ((Document)(m_WordDocsArr[0])).Content;
object brk = WdBreakType.wdSectionBreakNextPage;
object rngEnd = WdCollapseDirection.wdCollapseEnd;
rangeTrg.Collapse(ref rngEnd);

for (int i = 1; i < m_WordDocsArr.Count; i++)
{
   rangeTrg.InsertBreak(ref brk);
   Range rangeSrc = ((Document)(m_WordDocsArr[i])).Content;
   rangeTrg.FormattedText = rangeSrc.FormattedText;
   rangeTrg.Collapse(ref rngEnd);
}
////////////////////////


Problem #1:
If there is one document in m_WordDocsArr, afterwords when I open the .doc by doubleclicking it, Word opens it in Print Layout, if there is more than one document in m_WordDocsArr, Word opens it in Normal layout.
Why?

Problem #2:
The original templates I use have headers and footers.
Somewhy (???) the merged doc has the first document's headers and footers.
I tryed to save the headers and footers of the original docs before merging and assign them afterwords to each section, but the following code throws the exception:

////////////////////////////////
ArrayList footers = new ArrayList();
....
footers.Add(((Document)(m_WordDocsArr[i])).Sections.First.Footers[WdHeaderFooterIndex.wdHeaderFooterPrimary].Range.FormattedText);

.....
int ih = 0;
foreach (Section sec in ((Document)(m_WordDocsArr[0])).Sections)
{
   sec.Footers[WdHeaderFooterIndex.wdHeaderFooterPrimary].LinkToPrevious = false;
   sec.Footers[WdHeaderFooterIndex.wdHeaderFooterPrimary].Range.FormattedText = ((Range)footers[ih]).Duplicate; //exception at run time (could not copy ranges) 
   ih++;
}
///////////////////////////////


So it is not so trivial for me to merge the documents with their original formatting?????
Please help me !!!??? Confused | :confused:
Thanks.
QuestionHow to pass long text to a C# program ? Pin
Dinglewood22-Sep-08 21:16
Dinglewood22-Sep-08 21:16 
AnswerRe: How to pass long text to a C# program ? Pin
Tamer Oz22-Sep-08 21:24
Tamer Oz22-Sep-08 21:24 
GeneralRe: How to pass long text to a C# program ? Pin
Dinglewood22-Sep-08 21:36
Dinglewood22-Sep-08 21:36 
GeneralRe: How to pass long text to a C# program ? Pin
blackjack215022-Sep-08 21:44
blackjack215022-Sep-08 21:44 
GeneralRe: How to pass long text to a C# program ? Pin
Dinglewood22-Sep-08 22:42
Dinglewood22-Sep-08 22:42 
GeneralRe: How to pass long text to a C# program ? Pin
N a v a n e e t h22-Sep-08 22:48
N a v a n e e t h22-Sep-08 22:48 
GeneralRe: How to pass long text to a C# program ? Pin
Dinglewood22-Sep-08 22:53
Dinglewood22-Sep-08 22:53 
GeneralRe: How to pass long text to a C# program ? Pin
N a v a n e e t h22-Sep-08 23:07
N a v a n e e t h22-Sep-08 23:07 
AnswerRe: How to pass long text to a C# program ? Pin
V.22-Sep-08 23:01
professionalV.22-Sep-08 23:01 
AnswerRe: How to pass long text to a C# program ? Pin
PIEBALDconsult23-Sep-08 3:27
mvePIEBALDconsult23-Sep-08 3:27 
GeneralRe: How to pass long text to a C# program ? Pin
Mark Churchill23-Sep-08 23:08
Mark Churchill23-Sep-08 23:08 
Questioncode c# Pin
singhd22-Sep-08 21:13
singhd22-Sep-08 21:13 
AnswerRe: code c# Pin
Tamer Oz22-Sep-08 21:26
Tamer Oz22-Sep-08 21:26 
GeneralRe: code c# Pin
nelsonpaixao23-Sep-08 14:13
nelsonpaixao23-Sep-08 14:13 
Questiongdi+ render viewport/camera perspective only Pin
Leblanc Meneses22-Sep-08 20:58
Leblanc Meneses22-Sep-08 20:58 
AnswerRe: gdi+ render viewport/camera perspective only Pin
Harvey Saayman22-Sep-08 21:00
Harvey Saayman22-Sep-08 21:00 
GeneralRe: gdi+ render viewport/camera perspective only Pin
Leblanc Meneses22-Sep-08 21:13
Leblanc Meneses22-Sep-08 21:13 

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.