- זה יותר איטי ממה שאני הצעתי
- התוצאות לא משהו אא"כ בין מחרוזות באורך זהה
אולי אני לא פועל איתו נכון?
אולי אני לא פועל איתו נכון?
בC# קיימת הפונקציה contains שבודקת האם מחרוזת טקסט מכיל בתוכו מחרוזת טקסט אחרת
אבל מה קורה אם המחרוזת השניה מבולגנת (כלומר המילים אינם לפי הסדר) ואתה רוצה לבדוק אם היא קיימת בתוך מחרוזת הראשונה (לדוגמא אם נחפש את "כי זרע יקרא לך ביצחק" בתוך חומש בראשית).
בניתי לזה קוד והייתי שמח לקבל משוב - תודה מראש
public static bool StringContains(this string line, string[] searchPatternArray, int maxDistance)
{
maxDistance = maxDistance - searchPatternArray[searchPatternArray.Length - 1].Length;
List<List<int>> wordIndexesList = new List<List<int>>();
// Get indexes of each word in the line
foreach (string word in searchPatternArray)
{
var indexes = AllIndexesOf(line, word).ToList();
wordIndexesList.Add(indexes);
}
if (wordIndexesList.Any(list => list.Count == 0))
return false;
// Calculate if there is an occurrence of all words within the max distance
return IsWithinMaxDistance(wordIndexesList, maxDistance);
}
static IEnumerable<int> AllIndexesOf(string str, string value)
{
if (string.IsNullOrEmpty(value))
throw new ArgumentException("The string to find may not be empty", nameof(value));
int index = 0;
while (index < str.Length)
{
index = str.IndexOf(value, index);
if (index == -1)
break;
yield return index;
index += value.Length;
}
}
static bool IsWithinMaxDistance(List<List<int>> wordIndexesList, int maxDistance)
{
// Check if all words occur within the maximum distance
for (int i = 0; i < wordIndexesList[0].Count; i++)
{
int startIndex = wordIndexesList[0][i];
if (IsWithinMaxDistanceForIndex(wordIndexesList, maxDistance, 1, startIndex))
{
return true;
}
}
return false;
}
static bool IsWithinMaxDistanceForIndex(List<List<int>> wordIndexesList, int maxDistance, int wordIndex, int startIndex)
{
if (wordIndex >= wordIndexesList.Count)
return true; // All words checked within max distance
for (int j = 0; j < wordIndexesList[wordIndex].Count; j++)
{
int endIndex = wordIndexesList[wordIndex][j];
int distance = Math.Abs(endIndex - startIndex);
if (distance <= maxDistance)
{
if (IsWithinMaxDistanceForIndex(wordIndexesList, maxDistance, wordIndex + 1, endIndex))
{
return true;
}
}
else if (endIndex > startIndex)
{
// No need to check further as the indexes are sorted
break;
}
}
return false;
}
@אהרון-פלדמן
לא ברור לי מה המטרה שלך אבל אם זה בגלל שאתה מחפש מילון בלי חיבור לאינטרנט חשוב שתדע שיש את זה עדיין מובנה בוורד
רציתי לשאול האם ש דרך חינמית ופשוטה לעשות בדיקת עדכונים עבור התוכנה שלי? (C# wpf אם זה רלוונטי).
כרגע אני עושה אילתור שהתוכנה בודקת אם קיים קובץ מסויים בדרייב. ברגע שאני מעלה עדכון אני מוחק את הקובץ (העדכון הבא כבר מחפש קובץ אחר וכן הלאה). כמובן שגם התוכנה בודקת קודם אם אפשר להתחבר כדי לא לקבל תוצאות מטעות - בקיצור אילתור מאולתר.
אשמח לקבל כל מידע בנושא איך לעשות זאת בצורה נורמלית בדגש על חינמי.
@dovid כתב בהפקת דוחו"ת מWPF מה מומלץ?:
יש פקד WebView2 שזה בדיוק כרום.
@אביי
שים לב שיש שם מגבלה מעצבנת שם של 2mb ל- string מסתמא לא משנה כי הדוחות שלך לא יהיו כל כך גדולים?
@אביי
הייתי מתחיל עם תכנית פשוטה איך להציג את ה-html
אח"כ לפי זה נראה איך להתקדם - ייתכן מאוד שאתה לא ריך שום ספריה רק מבנה נתונים נכון ואולי קצת js
להכניס לwebbrowser יש לך פקודה שנקראת navigatetostring
@dovid
לא עזר
@dovid
תודה עכשיו אני יודע איך למנוע את פתיחת התפריט המובנה
אבל איך אני יוצר תפריט משלי?
מישהו יודע מה פשר ההודעה בvisual studio שאומרת "loading symbols"
לאחרונה ההודעה הזו קופצת לי כל הזמן וזה מאוד מעצבן
איפוס הגדרות לא עזר
מצו"ב תמונה
תודה מראש
רציתי לשאול האם יש דרך איך ליצור contextmenu (תפריט לחיצה ימנית) מותאם אישית עבור דף האינטרנט שלי?
תודה מראש
דוגמא נוספת כאן העץ מוסתר ואפשר לגשת אליו על ידי הצמדת העכבר לצד ימין של המסך.
<!DOCTYPE html>
<html lang="he">
<head>
<meta charset="UTF-8">
<style>
html, body {
height: 100%;
margin: 0;
padding: 0;
background-color: whitesmoke;
}
.container {
display: flex;
height: 100%;
}
.textContentBox {
background-color: white;
flex: 1;
height: 100%;
padding: 10px;
overflow-y: auto;
}
.treeView-container {
display: flex;
flex-direction: column;
height: 100%;
transition: 0.5s;
max-width:0.5%;
-webkit-touch-callout: none; /* iOS Safari */
-webkit-user-select: none; /* Safari */
-khtml-user-select: none; /* Konqueror HTML */
-moz-user-select: none; /* Firefox */
-ms-user-select: none; /* Internet Explorer/Edge */
user-select: none; /* Non-prefixed version, currently supported by Chrome and Opera */
}
#treeView-SearchInput {
margin: 10px;
height:25px;
border: 1px solid #ccc;
}
#treeView-SearchInput:focus {
outline: none;
}
.treeView {
height:100%;
overflow: auto;
margin-top: 5px;
white-space: nowrap;
text-indent: -40px;
}
.treeView details {
border-top: 1px solid #eaeaea;
border-bottom: 1px solid #eaeaea;
}
.treeView summary::-webkit-details-marker {
display: none;
}
.treeView summary {
transition: background-color 0.3s ease;
list-style: none;
}
.treeView summary:hover {
background-color: #eaeaea;
}
.treeView Button {
background: none;
border: none;
cursor: pointer;
font-weight: 500;
margin: 5px;
transition: background-color 0.3s ease;
border-radius: 50px;
}
.treeView button:hover {
background-color: #eaeaea;
}
</style>
</head>
<body dir="rtl">
<div class="container">
<div id="treeView-container" class="treeView-container" onmouseover="toggleTreeViewWidth()" onmouseout="toggleTreeViewWidth()">
<input type="text" id="treeView-SearchInput" onkeyup="findAndSelectItem()" placeholder="חפש כותרת...">
<div class="treeView" id="treeView"> </div>
</div>
<div class="textContentBox" id="contentBox">
<h2 id="בעל הטורים בראשית המאור, פרק א">פרק א</h2>
<h3 id="בעל הטורים בראשית המאור, פרק א, פסוק א">פסוק א</h3>
בראשית ברא. בגימטריא בראש השנה נברא (העולם), בראשית נוטריקון בראשונה ראה אלהים שיקבלו ישראל תורה.<p>
בראשית ברא אלהים ס''ת אמת מלמד שברא העולם באמת כמו שנאמר ראש דברך אמת וכן יש הרבה פסוקים ס''ת אמת:<p>
<h3 id="בעל הטורים בראשית המאור, פרק א, פסוק ב">פסוק ב</h3>
"תֹהוּ וָבֹהוּ" – ב'. הכא, ואידך: "רָאִיתִי אֶת הָאָרֶץ וְהִנֵּה תֹהוּ וָבֹהוּ" (ירמיהו ד כג). מלמד שצפה הקב"ה בבריאת העולם בחורבן הבית, שנחרב בשנת תה"ו, שהרי הבית הראשון עמד ת"י שנה, ונחרב בשנת תי"א. ובית שני עמד כמנין הית"ה, וזהו "וְהָאָרֶץ הָיְתָה". ואחר כך "חֹשֶׁךְ", רמז לגלויות. וכן דורש בבראשית רבה. דבר אחר: "וְהָאָרֶץ הָיְתָה תֹהוּ וָבֹהוּ" – בגימטריא "אלפים שנה בלי תורה".<p>
"וְרוּחַ אֱלֹהִים מְרַחֶפֶת" – בגימטריא: "זו היא רוחו של מלך המשיח".<p>
"וְחֹשֶׁךְ עַל פְּנֵי תְהוֹם" – ב' במסורת. הכא, ואידך: "וְחֹשֶׁךְ אֵי זֶה מְקֹמוֹ" (איוב לח יט). זה הוא שאמרו (חגיגה יא ב), שאין לשאול: "מה לפנים? מה לאחור?" "וְחֹשֶׁךְ אֵי זֶה מְקֹמוֹ", פירוש, שאין לשאול אי זה היה מקום החושך תחילה.<p>
"וְרוּחַ אֱלֹהִים" – ב' דסמיכי. הכא, ואידך: "וְרוּחַ אֱלֹהִים לָבְשָׁה אֶת זְכַרְיָה" (דברי הימים ב כד כ). קרי ביה הכא נמי: "וְרוּחַ אֱלֹהִים לָבְשָׁה". פירוש, שעל ידי לבושו אמר "וַיְהִי אוֹר", דכתיב בתריה: "וַיֹּאמֶר אֱלֹהִים יְהִי אוֹר". וזה הוא שדרשו רז"ל (ב"ר פרשה ג): ממעטה לבושו נבראת האורה.<p>
<h2 id="בעל הטורים בראשית המאור, פרק לח">פרק לח</h2>
<h3 id="בעל הטורים בראשית המאור, פרק לח, פסוק טו">פסוק טו</h3>
פרק לח, טו <p>
ויחשבה. ג' במסורה. הכא. ואידך: בפרשת לך לך (לעיל טו, ו) ויחשבה לו צדקה. ואידך: ויחשבה עלי לשכורה (ש"א א, יג): <p>
לזונה. ב' במסורה. ויחשבה לזונה. איכה היתה לזונה (ישעיה א, כא). מה תמר בבזיון ולבסוף בכבוד אף ירושלים סופה בכבוד, כדכתיב (זכריה ב, ט) ולכבוד אהיה בתוכה. וזהו זאת קומתך דמתה לתמר (שה"ש ז, ח).<p>
<h2 id="בעל הטורים בראשית המאור, פרק מד">פרק מד</h2>
<h3 id="בעל הטורים בראשית המאור, פרק מד, פסוק יח">פסוק יח</h3>
ויגש אליו יהודה: ס"ת שוא. שאמר לו אני שוה לך שכמו שאתה מלך גם אני מלך. ועל זה דורש במדרש (ברשית רבה צ"נ:ב') כי הנה המלכים נועדו (תהילים מ"ח:ה'):<p>
<h2 id="בעל הטורים בראשית המאור, פרק מט">פרק מט</h2>
<h3 id="בעל הטורים בראשית המאור, פרק מט, פסוק א">פסוק א</h3>
ויקרא יעקב אל בניו: שביקש לגלות להם הקץ ונסתם ממנו (פסחים נו.). אמר יעקב שמא יש בכם חטא. אמרו לו תדקדק בשמותנו ולא תמצא בהם אותיות חט. ואמר להם קם אין בהם אותיות קץ (עיין ירושלמי יומא ס״פ ז׳, בבלי שם עג:).<p>
</div>
</div>
<script>
function populateTreeView() {
const contentBox = document.getElementById('contentBox');
const treeView = document.getElementById('treeView');
let currentDetails = treeView;
let currentIndentLevel = 0;
// Loop through each heading element in contentBox
contentBox.querySelectorAll('h1, h2, h3, h4, h5, h6').forEach(heading => {
const indentLevel = parseInt(heading.tagName[1]);
// If the current heading has a lower or equal indent level to the previous one,
// we need to move up the tree to the appropriate parent details element
while (currentIndentLevel >= indentLevel) {
currentDetails = currentDetails.parentElement;
currentIndentLevel--;
}
// Create a new details and summary elements
const details = document.createElement('details');
const summary = document.createElement('summary');
const button = document.createElement('button');
summary.style.paddingRight = 20 * indentLevel + 'px';
button.textContent = '👁';
button.setAttribute('onclick', `treeViewSelection('${heading.id}')`);
button.setAttribute('title', 'הצג');
summary.appendChild(button);
summary.appendChild(document.createTextNode(heading.textContent));
details.appendChild(summary);
// Append the new details element to the currentDetails
currentDetails.appendChild(details);
// Update the currentDetails and currentIndentLevel for the next iteration
currentDetails = details;
currentIndentLevel = indentLevel;
});
}
function treeViewSelection(id) {
// Scroll the corresponding heading into view
const heading = document.getElementById(id);
if (heading) {
heading.scrollIntoView({ behavior: 'smooth', block: 'start' });
}
}
// Populate the tree view on page load
window.onload = populateTreeView;
//
//treeView-Search
//
function findAndSelectItem() {
var input = document.getElementById("treeView-SearchInput");
var filter = input.value.trim().toUpperCase().replace(/,/g, '');
var details = document.querySelectorAll("details");
var firstMatchFound = false;
// Collapse all details if filter is empty
if (filter === "") {
for (var i = 0; i < details.length; i++) {
details[i].open = false;
var summary = details[i].querySelector("summary");
details[i].style.display = "";
}
return; // Exit function
}
for (var i = 0; i < details.length; i++) {
var summary = details[i].querySelector("summary");
if (summary) {
var parentPath = getParentText(details[i]).replace(/👁/g, '').toUpperCase();
var summaryPath = summary.textContent.replace(/👁/g, '').trim().toUpperCase();
var fullPath = parentPath + " " + summaryPath;
// Highlight matching summaries
if (fullPath.includes(filter)) {
details[i].open = true;
details[i].style.display = "";
if (!firstMatchFound) {
summary.scrollIntoView({ behavior: 'smooth', block: 'center' });
firstMatchFound = true;
}
// Open parent details elements recursively
var parentDetails = details[i].parentNode;
while (parentDetails.tagName === 'DETAILS') {
parentDetails.open = true;
parentDetails.style.display = "";
parentDetails = parentDetails.parentNode;
}
} else {
details[i].open = false;
details[i].style.display = "none";
}
}
}
}
function getParentText(element) {
var text = "";
var parent = element.parentNode;
while (parent && parent.tagName.toLowerCase() === 'details') {
var summary = parent.querySelector("summary");
if (summary) {
text = summary.textContent.trim() + " " + text;
}
parent = parent.parentNode;
}
return text.trim();
}
function toggleTreeViewWidth() {
var element = document.getElementById("treeView-container");
if (!element) {
alert("Element with ID 'treeView-container' not found.");
return; // Exit the function if element is not found
}
if (element.style.maxWidth === "35%") {
element.style.maxWidth = "0.5%"
} else {
element.style.maxWidth = "35%";
}
}
</script>
</body>
</html>
@אביי
אני הייתי הולך על כיוון של html יש גם ספריות שממרים html ל-pdf בקלות או שפשוט תתן למשתמש להדפיס את ה-html לבד. על ידי יצירת לחצן פשוט שמתממשק עם הפקד של webveiw.
ככה גם יש לך שליטה מלאה על מה שקורה יש ספריות מאוד טובות להתנהלות עם html.
או שתעבוד בשילוב של json גם לזה יש ספריות מתקדמות.
אם אתה הולך על xaml אז תלך על flowdocument
https://learn.microsoft.com/en-us/dotnet/api/system.windows.controls.flowdocumentreader.print?view=windowsdesktop-8.0
קוד ל- treeview ב- html כולל חיפוש - אשמח לקבל משוב - תודה
עריכה: עשיתי המון שיפורים מצו"ב דוגמא מליאה.
בגירסה זו ה-treeview נוצר באופן דינאמי לפי הכותרות שבמסמך
(נחסם לי משום מה בנטפרי ה-jsfiddle שלו תוכלו להעתיק את הקוד לכאן כדי לראות את התוצאה).
<!DOCTYPE html>
<html lang="he">
<head>
<meta charset="UTF-8">
<style>
html, body {
height: 100%;
margin: 0;
padding: 0;
}
.container {
display: flex;
height: 100%;
}
.textContentBox {
background-color: white;
flex: 1;
height: 100%;
margin: 5px;
padding: 5px;
overflow-y: auto;
}
.treeView-container {
-webkit-touch-callout: none; /* iOS Safari */
-webkit-user-select: none; /* Safari */
-khtml-user-select: none; /* Konqueror HTML */
-moz-user-select: none; /* Firefox */
-ms-user-select: none; /* Internet Explorer/Edge */
user-select: none; /* Non-prefixed version, currently supported by Chrome and Opera */
max-width: 35%;
background-color: whitesmoke;
display: flex;
flex-direction: column;
margin: 5px;
padding: 5px;
height: 100%;
}
#treeView-SearchInput {
height:25px;
border: 1px solid #ccc;
}
#treeView-SearchInput:focus {
outline: none;
}
.treeView {
height:100%;
overflow: auto;
margin-top: 5px;
white-space: nowrap;
text-indent: -40px;
}
.treeView details {
border-top: 1px solid #eaeaea;
border-bottom: 1px solid #eaeaea;
}
.treeView summary::-webkit-details-marker {
display: none;
}
.treeView summary {
transition: background-color 0.3s ease;
list-style: none;
}
.treeView summary:hover {
background-color: #eaeaea;
}
.treeView Button {
background: none;
border: none;
cursor: pointer;
font-weight: 500;
margin: 5px;
transition: background-color 0.3s ease;
border-radius: 50px;
}
.treeView button:hover {
background-color: #eaeaea;
}
</style>
</head>
<body dir="rtl">
<div class="container">
<div class="treeView-container">
<input type="text" id="treeView-SearchInput" onkeyup="findAndSelectItem()" placeholder="חפש כותרת...">
<div class="treeView" id="treeView"> </div>
</div>
<div class="textContentBox" id="contentBox">
<h2 id="בעל הטורים בראשית המאור, פרק א">פרק א</h2>
<h3 id="בעל הטורים בראשית המאור, פרק א, פסוק א">פסוק א</h3>
בראשית ברא. בגימטריא בראש השנה נברא (העולם), בראשית נוטריקון בראשונה ראה אלהים שיקבלו ישראל תורה.<p>
בראשית ברא אלהים ס''ת אמת מלמד שברא העולם באמת כמו שנאמר ראש דברך אמת וכן יש הרבה פסוקים ס''ת אמת:<p>
<h3 id="בעל הטורים בראשית המאור, פרק א, פסוק ב">פסוק ב</h3>
"תֹהוּ וָבֹהוּ" – ב'. הכא, ואידך: "רָאִיתִי אֶת הָאָרֶץ וְהִנֵּה תֹהוּ וָבֹהוּ" (ירמיהו ד כג). מלמד שצפה הקב"ה בבריאת העולם בחורבן הבית, שנחרב בשנת תה"ו, שהרי הבית הראשון עמד ת"י שנה, ונחרב בשנת תי"א. ובית שני עמד כמנין הית"ה, וזהו "וְהָאָרֶץ הָיְתָה". ואחר כך "חֹשֶׁךְ", רמז לגלויות. וכן דורש בבראשית רבה. דבר אחר: "וְהָאָרֶץ הָיְתָה תֹהוּ וָבֹהוּ" – בגימטריא "אלפים שנה בלי תורה".<p>
"וְרוּחַ אֱלֹהִים מְרַחֶפֶת" – בגימטריא: "זו היא רוחו של מלך המשיח".<p>
"וְחֹשֶׁךְ עַל פְּנֵי תְהוֹם" – ב' במסורת. הכא, ואידך: "וְחֹשֶׁךְ אֵי זֶה מְקֹמוֹ" (איוב לח יט). זה הוא שאמרו (חגיגה יא ב), שאין לשאול: "מה לפנים? מה לאחור?" "וְחֹשֶׁךְ אֵי זֶה מְקֹמוֹ", פירוש, שאין לשאול אי זה היה מקום החושך תחילה.<p>
"וְרוּחַ אֱלֹהִים" – ב' דסמיכי. הכא, ואידך: "וְרוּחַ אֱלֹהִים לָבְשָׁה אֶת זְכַרְיָה" (דברי הימים ב כד כ). קרי ביה הכא נמי: "וְרוּחַ אֱלֹהִים לָבְשָׁה". פירוש, שעל ידי לבושו אמר "וַיְהִי אוֹר", דכתיב בתריה: "וַיֹּאמֶר אֱלֹהִים יְהִי אוֹר". וזה הוא שדרשו רז"ל (ב"ר פרשה ג): ממעטה לבושו נבראת האורה.<p>
<h2 id="בעל הטורים בראשית המאור, פרק לח">פרק לח</h2>
<h3 id="בעל הטורים בראשית המאור, פרק לח, פסוק טו">פסוק טו</h3>
פרק לח, טו <p>
ויחשבה. ג' במסורה. הכא. ואידך: בפרשת לך לך (לעיל טו, ו) ויחשבה לו צדקה. ואידך: ויחשבה עלי לשכורה (ש"א א, יג): <p>
לזונה. ב' במסורה. ויחשבה לזונה. איכה היתה לזונה (ישעיה א, כא). מה תמר בבזיון ולבסוף בכבוד אף ירושלים סופה בכבוד, כדכתיב (זכריה ב, ט) ולכבוד אהיה בתוכה. וזהו זאת קומתך דמתה לתמר (שה"ש ז, ח).<p>
<h2 id="בעל הטורים בראשית המאור, פרק מד">פרק מד</h2>
<h3 id="בעל הטורים בראשית המאור, פרק מד, פסוק יח">פסוק יח</h3>
ויגש אליו יהודה: ס"ת שוא. שאמר לו אני שוה לך שכמו שאתה מלך גם אני מלך. ועל זה דורש במדרש (ברשית רבה צ"נ:ב') כי הנה המלכים נועדו (תהילים מ"ח:ה'):<p>
<h2 id="בעל הטורים בראשית המאור, פרק מט">פרק מט</h2>
<h3 id="בעל הטורים בראשית המאור, פרק מט, פסוק א">פסוק א</h3>
ויקרא יעקב אל בניו: שביקש לגלות להם הקץ ונסתם ממנו (פסחים נו.). אמר יעקב שמא יש בכם חטא. אמרו לו תדקדק בשמותנו ולא תמצא בהם אותיות חט. ואמר להם קם אין בהם אותיות קץ (עיין ירושלמי יומא ס״פ ז׳, בבלי שם עג:).<p>
</div>
</div>
<script>
function populateTreeView() {
const contentBox = document.getElementById('contentBox');
const treeView = document.getElementById('treeView');
let currentDetails = treeView;
let currentIndentLevel = 0;
// Loop through each heading element in contentBox
contentBox.querySelectorAll('h1, h2, h3, h4, h5, h6').forEach(heading => {
const indentLevel = parseInt(heading.tagName[1]);
// If the current heading has a lower or equal indent level to the previous one,
// we need to move up the tree to the appropriate parent details element
while (currentIndentLevel >= indentLevel) {
currentDetails = currentDetails.parentElement;
currentIndentLevel--;
}
// Create a new details and summary elements
const details = document.createElement('details');
const summary = document.createElement('summary');
const button = document.createElement('button');
summary.style.paddingRight = 20 * indentLevel + 'px';
button.textContent = '👁';
button.setAttribute('onclick', `treeViewSelection('${heading.id}')`);
button.setAttribute('title', 'הצג');
summary.appendChild(button);
summary.appendChild(document.createTextNode(heading.textContent));
details.appendChild(summary);
// Append the new details element to the currentDetails
currentDetails.appendChild(details);
// Update the currentDetails and currentIndentLevel for the next iteration
currentDetails = details;
currentIndentLevel = indentLevel;
});
}
function treeViewSelection(id) {
// Scroll the corresponding heading into view
const heading = document.getElementById(id);
if (heading) {
heading.scrollIntoView({ behavior: 'smooth', block: 'start' });
}
}
// Populate the tree view on page load
window.onload = populateTreeView;
//
//treeView-Search
//
function findAndSelectItem() {
var input = document.getElementById("treeView-SearchInput");
var filter = input.value.trim().toUpperCase().replace(/,/g, '');
var details = document.querySelectorAll("details");
var firstMatchFound = false;
// Collapse all details if filter is empty
if (filter === "") {
for (var i = 0; i < details.length; i++) {
details[i].open = false;
var summary = details[i].querySelector("summary");
details[i].style.display = "";
}
return; // Exit function
}
for (var i = 0; i < details.length; i++) {
var summary = details[i].querySelector("summary");
if (summary) {
var parentPath = getParentText(details[i]).replace(/👁/g, '').toUpperCase();
var summaryPath = summary.textContent.replace(/👁/g, '').trim().toUpperCase();
var fullPath = parentPath + " " + summaryPath;
// Highlight matching summaries
if (fullPath.includes(filter)) {
details[i].open = true;
details[i].style.display = "";
if (!firstMatchFound) {
summary.scrollIntoView({ behavior: 'smooth', block: 'center' });
firstMatchFound = true;
}
// Open parent details elements recursively
var parentDetails = details[i].parentNode;
while (parentDetails.tagName === 'DETAILS') {
parentDetails.open = true;
parentDetails.style.display = "";
parentDetails = parentDetails.parentNode;
}
} else {
details[i].open = false;
details[i].style.display = "none";
}
}
}
}
function getParentText(element) {
var text = "";
var parent = element.parentNode;
while (parent && parent.tagName.toLowerCase() === 'details') {
var summary = parent.querySelector("summary");
if (summary) {
text = summary.textContent.trim() + " " + text;
}
parent = parent.parentNode;
}
return text.trim();
}
</script>
</body>
</html>
@pcinfogmach כתב באיך לקלוט פקד שנמצא בתוך controltempalte ב-wpf ?:
ועוד שאלה:
במקרה הזה ה-TreeView לא נטען עד שפותחים את ה-combobox האם יש איזה טריק שאוכל לעשות שייטען כאשר פותחים את היוזר פורם בו נמצא הcombobox?
לבינתיים עשיתי שה-combobox יהיה פתוח כהuserform נפתח ואז עשיתי שטעינת ה-tree דהיינו ה-load יסגור את ה-comboview עם תנאי bool שזה יקרה רק בטעינה הראשונה - המשתמש לא רואה כלום. דא עקא שזה די מאט את טעינת הuserform.
יצרתי template עבור comboboxitem ב-wpf
כרגיל אני מצליח לקבל גישה אל אובייקטים מסוג זה דרך visualtreehelper או logicaltreehelper
במקרה שלי זה לא עובד לי. אשמח לקבל עזרה.
מצו"ב הקוד xaml אני מנזה לקבל גישה ל-treeview
<ComboBox x:Name="HeadersCombo" Width="0" MaxDropDownHeight="300">
<ComboBox.Resources>
<Style TargetType="ComboBoxItem">
<Setter Property="Template">
<Setter.Value>
<ControlTemplate>
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="*"/>
</Grid.RowDefinitions>
<TextBox x:Name="ChapterTreeTexBox" Text="חפש כותרת"
Height="20" MinWidth="50" MaxWidth="200"
Grid.Row="0" Margin="2"
Loaded="ChapterTreeTextBox_Loaded"
KeyUp="ChapterTreeTexBox_KeyUp"/>
<Separator Grid.Row="1" Margin="0" Padding="0"/>
<TreeView x:Name="chapterTree" Grid.Row="2"
BorderThickness="0" Padding="3"
MaxHeight="260" MaxWidth="200"
ItemsSource="{Binding IdItemsCollection}">
<TreeView.Resources>
<HierarchicalDataTemplate DataType="{x:Type chpaterTreeSource:IdItem}" ItemsSource="{Binding IdChildren}">
<TextBlock Text="{Binding ShortId}" Margin="0,3,5,3"
Tag="{Binding BindsDirectlyToSource=True}"
PreviewMouseDown="chapterTreeItem_PreviewMouseDown"/>
</HierarchicalDataTemplate>
<Style TargetType="TreeViewItem">
<Setter Property="IsExpanded" Value="True"/>
</Style>
</TreeView.Resources>
</TreeView>
</Grid>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
</ComboBox.Resources>
<ComboBoxItem/>
</ComboBox>
ועוד שאלה:
במקרה הזה ה-TreeView לא נטען עד שפותחים את ה-combobox האם יש איזה טריק שאוכל לעשות שייטען כאשר פותחים את היוזר פורם בו נמצא הcombobox?
תודה מראש
@חגי
תודה רבה הפוסט עצמו גם היה מאוד אינפורמטיבי
כלומר התגובה הזו
https://stackoverflow.com/a/44118559/23343154
לאחר שחקרתי את הנושא אני חייב להגיד שיצאתי מאוכזב רוב הפקדים לא שווים כלום גם אלו שבשתלום כל מה שהם עושים זה להמיר את המסמך לתמונות ולהציג אותו בlistview וכדומה.
pdfiumviewer - אפשרות פשוטה יחסית:
תודות ל@חגי הצלחתי להפעיל את pdfium https://tchumim.com/post/161320 אמנם הוא מוגבל ל-winforms אבל הוא די מתקדם התפעלתי מהעובדה שיש שם גם אפשרות חיפוש. אבל תכל'ס המראה לא מרשים מדאי. וגם אין שם אפשרות לבחור סטקסט של מסמכים שעברו ocr ועוד כמה חסרונות.
בכל אופן בשביל הצגת מסמכים פשוטה הפקד של pdfiumviewer נחמד מאוד.
מה כן עובד טוב יחסית:
מה עוד לא הצלחתי לבדוק:
@חגי
אין כמוך!
אני מצרף לינק לתשובה המדוייקת שם שעזרה לי
https://stackoverflow.com/a/67373337/23343154
@חגי
תודה
גם זה לא עובד לי עדכנתי את הפוסט למעלה עם מה שקרה