2017-05-01 19 views
7

I am cross-posting this question from Microsoft Community의 앞에 포맷 헤더의 이미지를 처리 ​​할 수없는, 어쩌면 여기 사람이 되거 수 있습니다.BUG : 내가 거기에 어떤 응답을 확보하지 않았기 때문에 말씀 2013 VSTO는 뒤에 또는 텍스트

나는 문서를 처리 할 VSTO를 사용할 때 워드 2013에 특정한 문제를 발견했습니다.

문서는 레이아웃 옵션 "텍스트 배치와 함께"로 설정된 머리글 또는 바닥 글에 이미지를 포함하거나 "텍스트의 앞에"또는 "텍스트 뒤에"와 :

Image with Layout Options set to "With Text Wrapping" with "Behind Text"

사용 내가 여기에 생식을 업로드 한

The remote procedure call failed. (Exception from HRESULT: 0x800706BE) 

: Word2013VstoImageFormattedInHeaderBug.zip

I 문서를 연 다음 모양을 처리하려고하면 VSTO는, 나는 다음과 같은 예외를 얻을 여기
private static bool ShapesWithinGroup(Shape shape) 
{ 
    var result = false; 
    try 
    { 
     // shape.GroupItems throws the exception 
     if (shape.GroupItems != null && shape.GroupItems.Count > 0) 
     { 
      result = true; 
     } 
    } 
    catch (UnauthorizedAccessException) 
    { 
     // This shape is not in a group - ignore 
    } 
    catch (Exception exception) 
    { 
     var exceptionString = exception.BuildExceptionString(); 
     Console.WriteLine(exceptionString); 
     Console.WriteLine(exception.StackTrace); 
     //throw; 
    } 

    return result; 
} 

전체 예외 스택 트레이스입니다 : 코드의

관련 부분은 WordFieldEnumerator.cs

The remote procedure call failed. (Exception from HRESULT: 0x800706BE) 

    at Microsoft.Office.Interop.Word.Shape.get_GroupItems() 
    at Word2013VstoImageFormattedInHeaderBug.WordFieldEnumerator.ShapesWithinGroup(Shape shape) in C:\Users\QA\Desktop\Word2013VstoImageFormattedInHeaderBug\Word2013VstoImageFormattedInHeaderBug\WordFieldEnumerator.cs:line 170 
The RPC server is unavailable. (Exception from HRESULT: 0x800706BA) 

    at Microsoft.Office.Interop.Word.Shape.get_TextFrame() 
    at Word2013VstoImageFormattedInHeaderBug.WordFieldEnumerator.ProcessShapes(IEnumerable`1 shapes) in C:\Users\QA\Desktop\Word2013VstoImageFormattedInHeaderBug\Word2013VstoImageFormattedInHeaderBug\WordFieldEnumerator.cs:line 124 
The RPC server is unavailable. (Exception from HRESULT: 0x800706BA) 

    at System.Runtime.InteropServices.Marshal.ThrowExceptionForHRInternal(Int32 errorCode, IntPtr errorInfo) 
    at System.Runtime.InteropServices.CustomMarshalers.EnumeratorViewOfEnumVariant.MoveNext() 
    at System.Linq.Enumerable.<CastIterator>d__aa`1.MoveNext() 
    at Word2013VstoImageFormattedInHeaderBug.WordFieldEnumerator.ProcessShapes(IEnumerable`1 shapes) in C:\Users\QA\Desktop\Word2013VstoImageFormattedInHeaderBug\Word2013VstoImageFormattedInHeaderBug\WordFieldEnumerator.cs:line 90 
    at Word2013VstoImageFormattedInHeaderBug.WordFieldEnumerator.GetAllFields() in C:\Users\QA\Desktop\Word2013VstoImageFormattedInHeaderBug\Word2013VstoImageFormattedInHeaderBug\WordFieldEnumerator.cs:line 64 
    at Word2013VstoImageFormattedInHeaderBug.Program.LockDialogFields(Document document) in C:\Users\QA\Desktop\Word2013VstoImageFormattedInHeaderBug\Word2013VstoImageFormattedInHeaderBug\Program.cs:line 116 
    at Word2013VstoImageFormattedInHeaderBug.Program.PdfDocument(String documentFilePath) in C:\Users\QA\Desktop\Word2013VstoImageFormattedInHeaderBug\Word2013VstoImageFormattedInHeaderBug\Program.cs:line 60 

예외에 관계없이 내가 그것을 잡으려고 시도 여부에 던져이며, 충돌 워드 2013 :

Event Viewer entry

이 버그는 워드 2016에 발생하지 않습니다, 모양을 성공적으로 처리 할 수 ​​있습니다. 그러나 Office 2016으로 업그레이드하는 것은 옵션이 아닙니다. 버그 수정을 위해 Office 2013 핫픽스가 필요하다고 생각됩니다.

I 2013 말씀이 작업을 얻기 위해 할 수있는 일이 있나요? Office 2013의 여러 번 수리 및 다시 설치를 포함하여 수많은 예상 된 수정 사항을 사용해 보았습니다.

+1

1. [비디오 드라이버를 업데이트] 적이 (http://codeworks.it/blog/?p=136)? 2. 안티 바이러스/방화벽을 끄면 어떤 차이가 있습니까? 3. [wwlib.dll] (https://answers.microsoft.com/ko-ko/office/forum/office_2010-word/word-2010-crash-once-in-two-days-event-viewer/8b415426-3486-45c9-801a-01cbc114b184) 및 사무실 수리를 원하십니까? 4. 서버 OS에서 실행하지 않습니까? 5. [셰이프를 사용하는 코드] (https://social.msdn.microsoft.com/Forums/office/en-US/b89dd0df-d46a-4fbd-97fe-d597fc292ceb/problem-setting-width-for-inlineshape) ? forum = worddev) 맞습니까? –

+0

@JeremyThompson 1. 예. 2. 아니오. 3. 예. 4. 아니요, Windows 10 64 비트 버전 1511 (OS 빌드 10586.318), Word 2013 32 비트 15.0.4823.1000 (MSO 15.0.4823.1000), Office Standard 2013의 일부입니다. 5. 예. 버그가 여전히 발생하고 Word가 여전히 충돌합니다. 제가 확인해야 할 것이 있습니까? –

+0

그룹이 아닌 경우 예외를 잡는 대신 모양의 '유형'을 선택하면 여전히 문제가 발생합니까? – Chris

답변

1

모양은 아무 곳이나 페이지에 배치 할 수 있지만 항상 텍스트의 고정 범위에 부착된다. 고정 된 도형을 반복하기 전에 현재 범위를 선택하면 HRESULT 0x80010105 RPC_E_SERVERFAULT 예외가 해결 될 수 있습니다. 당신의 GetAllFields() 방법에서

, 선택() 각각 ProcessShapes()를 호출하기 전에 머리글과 바닥 글의 범위.

foreach (HeaderFooter header in section.Headers) 
{ 
    if (header.LinkToPrevious) // || header.Index != WdHeaderFooterIndex.wdHeaderFooterFirstPage 
    { 
     continue; 
    } 

    header.Range.Select(); 

    // Add the fields in the header 
    fields.AddRange(header.Range.Fields.Cast<Field>()); 

    // Add the fields in the shapes in the header 
    var fieldsInShapes = ProcessShapes(header.Shapes.Cast<Shape>()); 
    fields.AddRange(fieldsInShapes); 
} 

foreach (HeaderFooter footer in section.Footers) 
{ 
    if (footer.LinkToPrevious) // || footer.Index != WdHeaderFooterIndex.wdHeaderFooterFirstPage 
    { 
     continue; 
    } 

    footer.Range.Select(); 

    // Add the fields in the footer 
    fields.AddRange(footer.Range.Fields.Cast<Field>()); 

    // Add the fields in the shapes in the footer 
    var fieldsInShapes = ProcessShapes(footer.Shapes.Cast<Shape>()); 
    fields.AddRange(fieldsInShapes); 
} 

이 방법이 도움이 될지 모르겠다. (난 더 말씀 상호 운용성 전문가는 아니지만 ..) 내가 많이 후 클래스 가 오류없이 가능한 한 잘 작동

//foreach (Section section in Document.Sections) 
      //{ 
      // foreach (HeaderFooter header in section.Headers) 
      // { 
      //  if (header.LinkToPrevious) // || header.Index != WdHeaderFooterIndex.wdHeaderFooterFirstPage 
      //  { 
      //   continue; 
      //  } 
      //  // Add the fields in the header 
      //  fields.AddRange(header.Range.Fields.Cast<Field>()); 

      //  // Add the fields in the shapes in the header 
      //  var fieldsInShapes = ProcessShapes(header.Shapes.Cast<Shape>()); 
      //  fields.AddRange(fieldsInShapes); 
      // } 

      // foreach (HeaderFooter footer in section.Footers) 
      // { 
      //  if (footer.LinkToPrevious) // || footer.Index != WdHeaderFooterIndex.wdHeaderFooterFirstPage 
      //  { 
      //   continue; 
      //  } 
      //  // Add the fields in the footer 
      //  fields.AddRange(footer.Range.Fields.Cast<Field>()); 

      //  // Add the fields in the shapes in the footer 
      //  var fieldsInShapes = ProcessShapes(footer.Shapes.Cast<Shape>()); 
      //  fields.AddRange(fieldsInShapes); 
      // } 
      //} 

WordFieldEnumerator에서이 코드를 주석이 작업

+0

범위 대신 모양에 초점을 맞춘다면 흥미 롭습니다. 나는 이것을 발사하고 그것이 어떻게 진행되는지 알려줄 것이다. 응답 해 주셔서 감사합니다. –

+0

QA 부서에서 Word 2013에 대한이 수정본을 승인했습니다. 그들은 공식적으로 버그를 수정 된 것으로 표시하기 전에 몇 가지 테스트를 더 진행해야합니다. 나는 그 때 너에게 현상금을 수여 할 것이다. 나는 완전히 어리석은 방법을 표현할 수 없다. (바보는 말할 것도 없다.) 그러나 이것은 VSTO와 COM으로, 이런 종류의 문제에 대한 해결책이 왼쪽 필드에서 나올 것으로 예상된다! 다시 한 번 감사드립니다! –

+0

안녕하세요. 많은 사람들이 Office Interop/VSTO SDK가 최소한 (스스로 포함 된) 말하기에 까다로울 것이라고 생각합니다. 나는 당신과 팀을 위해 다시 올바른 길에 있고 다행스럽게도 기꺼이 감사합니다. 해피 코딩!/Fredrik – Fredrik

0

; 오류는 모양에 그들이 가지고 머리글과 바닥 글에 액세스 문제가

+0

아쉽게도 Word 2013 충돌을 일으키는 코드를 주석으로 처리해도 수정되지 않습니다. 죄송합니다. –