crossrider: store snapshot of bookmarks in local database and compare to current bookmarks list
Date : March 29 2020, 07:55 AM
Hope this helps Conceptually, you can achieve your goal by storing the previous bookmarks list in the extension's local database using appAPI.db.async, comparing it to the current bookmark list obtained using appAPI.bookmarks.getTree, and sending it to your API server using appAPI.request.post. You can use the following code in your background.js file as your starting point for handling the bookmarks lists and write your own comparison function (getChanges) as you require: appAPI.ready(function() {
// Poll every 30 seconds
setInterval(function() {
appAPI.db.async.get('prevBookmarks', function(value) {
// Load or initialize previous bookmarks list
var prevBookmarks = (value) ? value : {};
// Get current bookmarks
appAPI.bookmarks.getTree(function(nodes) {
// Save bookmark list for next comparison
appAPI.db.async.set('prevBookmarks', nodes);
// In your getChanges functions, traverse the bookmark trees collating
// changes and then post then to your API server using appAPI.request
var changes = getChanges(prevBookmarks, nodes);
appAPI.request.post({
url: http://yourAPIserver.com,
postData: changes,
contentType: 'application/json'
});
});
});
}, 30 * 1000);
});
|
Copying excel cells (ex. A1:C10) to word document using bookmarks without deleting the bookmarks
Tag : excel , By : Matt Croydon
Date : March 29 2020, 07:55 AM
With these it helps There is a way to re-use bookmarks, but if I correctly understand what you're doing it would be much better for you to create a template file (.dotx) and generate a new document from it for each iteration. Your code should then be Set myDoc = Documents.Add("template path")
For Each bkm In myDoc.Bookmarks
Dim rngBkm as Word.Range
For Each bkm In myDoc.Bookmarks
If bkm.Name = bkmname Then
Set rngBkm = bkm.Range
rngBkm.Text = "new content"
myDoc.Bookmarks.Add(rngBkm, bkmname)
End If
Next
|
Tag : vb.net , By : James Lupiani
Date : March 29 2020, 07:55 AM
To fix the issue you can do You could Clone the DataTable which keeps columns but "removes" data: Dim oldTable As DataTable = CType(displayResults.DataSource, DataView).Table
Dim emptyTable As DataTable = oldTable.Clone()
displayResults.DataSource = emptyTable ' or emptyTable.DefaultView
oldTable.Rows.Clear()
|
iText 7.0.5: How to combine PDF and have existing bookmarks indented under new bookmarks for each document?
Tag : java , By : mckasty
Date : March 29 2020, 07:55 AM
Hope that helps Rather than shift bookmarks in the combined PDF, I did it in the component PDF before merging. Feedback welcome, especially if something is horribly inefficient as PDF size increases: private static void shiftPdfBookmarksUnderNewBookmark(PdfDocument pdfDocument, String bookmarkLabel) {
if (pdfDocument == null || pdfDocument.getWriter() == null) {
log.warn("shiftPdfBookmarksUnderNewBookmark(): no writer linked to PDFDocument, cannot modify bookmarks");
return;
}
pdfDocument.initializeOutlines();
try {
PdfOutline rootOutline = pdfDocument.getOutlines(false);
PdfOutline subOutline = rootOutline.addOutline(bookmarkLabel);
subOutline.addDestination(PdfExplicitDestination.createFit(pdfDocument.getFirstPage())); // Not sure why this is needed, but problems if omitted.
List<PdfOutline> pdfOutlineChildren = rootOutline.getAllChildren();
if (pdfOutlineChildren.size() == 1) {
return;
}
int i = 0;
for (PdfOutline p : rootOutline.getAllChildren()) {
if (p != subOutline) {
if (p.getDestination() == null) {
continue;
}
subOutline.addOutline(p);
}
}
rootOutline.getAllChildren().clear();
rootOutline.addOutline(subOutline);
subOutline.addDestination(PdfExplicitDestination.createFit(pdfDocument.getFirstPage())); // not sure why duplicate line above seems to be needed
}
catch (Exception logAndIgnore) {
log.warn("shiftPdfBookmarksUnderNewBookmark ignoring error and not shifting bookmarks: " +logAndIgnore, logAndIgnore);
}
}
|
Chrome Bookmarks API - using 'Move' to reorder bookmarks in the same folder
Date : March 29 2020, 07:55 AM
|