diff --git a/zaaReloaded2/Importer/ZaaImporter/AutoDetect.cs b/zaaReloaded2/Importer/ZaaImporter/AutoDetect.cs
index ac9a129..9e32b15 100755
--- a/zaaReloaded2/Importer/ZaaImporter/AutoDetect.cs
+++ b/zaaReloaded2/Importer/ZaaImporter/AutoDetect.cs
@@ -46,9 +46,23 @@ namespace zaaReloaded2.Importer.ZaaImporter
Paragraph start = null;
Paragraph end = null;
int i = 1;
+
+ if (document.Bookmarks.Exists("Labor"))
+ {
+ i = GetParagraphIndex(
+ document,
+ document.Bookmarks["Labor"].Range.Paragraphs[1]);
+ }
+
while (i <= document.Paragraphs.Count)
{
- if (IsLabParagraph(document.Paragraphs[i]))
+ // Expect the first paragraph of a Lauris block to be
+ // a time stamp. This prevents erroneous detection of
+ // lines such as "Tel. (09 31) 201-39432; -39126", which
+ // happen to structurally resemble a paragraph with
+ // laboratory items.
+ if (LaurisTimePoint.IsTimeStampLine(
+ document.Paragraphs[i].Range.Text))
{
start = document.Paragraphs[i];
break;
@@ -87,5 +101,18 @@ namespace zaaReloaded2.Importer.ZaaImporter
return (LaurisParagraph.ResemblesLaurisParagraph(text)
|| LaurisTimePoint.IsTimeStampLine(text));
}
+
+ ///
+ /// Returns the index of a paragraph.
+ ///
+ ///
+ /// http://word.mvps.org/faqs/macrosvba/GetIndexNoOfPara.htm
+ ///
+ /// Paragraph whose index to return.
+ /// Index of the paragraph.
+ private static int GetParagraphIndex(Document document, Paragraph paragraph)
+ {
+ return document.Range(0, paragraph.Range.Start).Paragraphs.Count;
+ }
}
}