How To Position a Picture on A Second Page Of A Word Document VB6 - ms-word

I am making a program that repeatedly creates pages of an undefined quantity, and on the top of all the pages is a logo that is in a certain position. If I have everything in a for loop and at the end I include these commands to make a page break:
Set oRng = oDoc.Bookmarks("\EndOfDoc").Range
oRng.InsertBreak
The second time (and subsequent times) the table I make goes on the the next page, but the image does not. I have tried setting the "top" property to
distFromTop + pageLength * pageNumber.
I would assume it might have to do with the anchor property, but I have no idea what data type that even gets or how it affects the placement
I insert the image using:
oDoc.Shapes.AddPicture "C:\Users\name\Desktop\file.jpg", , , CentimetersToPoints(1.3), CentimetersToPoints(0.9 + pageLength * j), CentimetersToPoints(6.1), CentimetersToPoints(2.9)
The picture adds multiple times, but both to .9 from the top on the first page and 1.3 from the left, on the first page.
How can I make the pic go .9 from the top of a certain page
EDIT: I would like to avoid putting it in a header because that would mess up the alignment of the other elements of the doc

Ok, So what worked for me was this:
Set oRng = oDoc.Bookmarks("\EndOfDoc").Range
oRng.InsertBreak
oDoc.Shapes.AddPicture "C:\Users\me\Desktop\file.jpg", , , CentimetersToPoints(1.3),
CentimetersToPoints(0.9), CentimetersToPoints(6.1), CentimetersToPoints(2.9),
oDoc.Bookmarks("\EndOfDoc").Range
I still don't quite understand why it works, because the documentation for a range objects / anchors was fairly hard for me to understand... I tried this out and this worked. For my purposes that worked, but if anyone knows why that works I would love to know
Thanks for your answers

Related

VS Code brings search result line to the center of the screen

When you search for a keyword in VS Code, and it returns x results, as you start browsing among those results, the screen always centers vertically the active result on the screen. This may be useful in some situations, but in cases where I want to "frame" all my results in the same active screen, it's very annoying that it jumps the code, even by 2-3 lines...
OK, if in that viewable portion of the code there are no results, and I click on the next result, it'd make sense to bring me to the first one. But if let's say 4-5 results are already in the viewable portion of the code, I would like to set it so that it prevents that centering all the time. So is there such a setting?
I hope I explained it well enough so that you understand what I mean. TIA for any help.
I don't think that is configurable if the next find match is outside of the viewport. I see this in the code:
(https://github.com/microsoft/vscode/blob/7a0a293b38c353cd9773316a022d8f926d481715/src/vs/editor/contrib/find/browser/findModel.ts)
private _setCurrentFindMatch(match: Range): void {
let matchesPosition = this._decorations.setCurrentFindMatch(match);
this._state.changeMatchInfo(
matchesPosition,
this._decorations.getCount(),
match
);
this._editor.setSelection(match);
this._editor.revealRangeInCenterIfOutsideViewport(match, ScrollType.Smooth);
}
So revealRangeInCenterIfOutsideViewport() will always put the next find match into the center if it is not initially not in the viewport.
In the search code, there is the similar:
this.searchResultEditor.revealLineInCenterIfOutsideViewport(matchRange.startLineNumber);
So I would think there is no scrolling if the next serach result is already in view.
For me, there is no scrolliing at all if the next find match is anywhere in the viewport. Do you see some scrolling if it is at the very bottom, for example?

iText7 How do I know Table flows to next page like ITextshap Column.HasMoretext?

I have a form where I have to place some fixed data on top and bottom with a variable table in between. If table does not fit on first page, there should be created more pages as needed to acomodate Table.
But for page 2, 3, 4... I still have to print top & bottom, but this time a short version of whats was placed on page 1.
In ItextSharp5 with ColumnText.HasMoreText = true, I know when a new page is needed and can make a new page with proper top & bottom data before drop remaining table.
So how can I achieve same behaviour with iText7?
I did not found a way to know when a table needs some more room
After some reading, found a starting point at Chapter 2: Adding content to a Canvas or a Document
on 3th block of code.

How to add a "tutorial message div" to figures?

After installing R2018b, the first figure I opened contained an interesting message (shown in blue):
The reason it's interesting is because it contains features like text wrapping, transparency, the fact that the image maintains a constant width even though the text resizes (this reminded me of CSS3 flexbox, hence the tag), etc.
The last part of the animation is in slow motion, to better show how the div's size follows that of the figure.
In case it matters, I'm using Win 10 v1803.
Question:
I'd like to know how we can draw similar, custom, divs (for a lack of a better word) in our figures. (It's important to stress that this is not a UIFigure!)
What I found so far:
The Learn More link opens the page:
web(fullfile(docroot, 'matlab/creating_plots/interactively-explore-plotted-data.html'))
yet breakpoints in the entry points of either web or docroot (or even doc) aren't hit.
Assuming that this element is a Child of the figure, I attempted to locate a handle to it:
>> set(gcf,'MenuBar','none'); findall(gcf)
ans =
22×1 graphics array:
Figure (1)
ContextMenu
AnnotationPane
Axes
AxesToolbar
Text
Text
Text
ToolbarStateButton (Brush/Select Data)
ToolbarStateButton (Data Tips)
ToolbarStateButton (Rotate 3-D)
ToolbarStateButton (Pan)
ToolbarStateButton (Zoom In)
ToolbarStateButton (Zoom Out)
ToolbarPushButton (Restore View)
Button
Button
Button
Button
Button
Button
Button
however, making these controls invisible using set(h(2:end), 'Visible', false) didn't make the div disappear.
Saving the figure as .fig or generating code for it, doesn't leave any trace of this div.
When uiinspect-ing the figure, this div doesn't show (or at least, I couldn't find it).
I don't know what exactly I did to make it reappear once more, but since it's set to appear on the very first time you boot R2018b, I suspect deleting prefdir (obviously, after backing it up) and restarting MATLAB could bring it back.
The only thing I didn't try yet, is to attach a java debugger to MATLAB and attempt to trace the caller to com.mathworks.mlservices.MLHelpServices.setCurrentLocation (from mlservices.jar), which opens the help browser.
After some digging in the Java side of things (starting from findjobj, followed by a lot of .getComponent(0).getComponent(0)...), I've finally managed to locate the component in question. Here's what I learned:
This component is called InfoPanel, and is part of MATLAB's Java API. The class definition itself is found in:
MATLAB/R2018b/java/jar/hg.jar!/com/mathworks/hg/util/InfoPanel.class
To make it appear, we need to call the static method addBannerPanel, passing in a figure handle:
com.mathworks.hg.util.InfoPanel.addBannerPanel( figure(randi(1E4)) );
Or another signature that also accepts a custom panel:
jIP = com.mathworks.hg.util.InfoPanel;
jIP.setBackground(java.awt.Color(0.8, 0.7, 0.1));
com.mathworks.hg.util.InfoPanel.addBannerPanel( figure(randi(1E4)), jIP );
The MATLAB setting that controls whether this should appear is showinteractioninfobar inside the <prefdir>/matlab.settings XML.
It appears that the "interesting parts" of InfoPanel are private, which means it allows barely any customization (mostly some colors; not the string or the icon), but it should be fairly easy to make a copy of this class and expose all elements we need.

Erratic UIPageControls

I'm using two UIPageControls in a view to reflect chapters and pages. So I have defined one UIPageControl named chapterCount and one named pageCount just to show where the user is. I handle the flipping of the pages with swipes rather than using the UIPageControls (so no methods defined for them).
I change their values as the user change pages with the following code:
chapterCount.numberOfPages = chapters;
chapterCount.currentPage = chapterNumber;
pageCount.numberOfPages = pages;
pageCount.currentPage = pageNumber;
[chapterCount updateCurrentPageDisplay];
[pageCount updateCurrentPageDisplay];
Where chapters, chapterNumber, pages and pageNumber all are integers.
The first time I flip through the pages it normally works fine, but when I go to a previous chapter or start a new chapter, the first (or last depending on direction) dot is not showed. Please see picture (upper half is missing a dot, lower one OK).
alt text http://img80.imageshack.us/img80/3339/pagecontrol.png
Its the same code updating the controls and sometime I get a dot, sometimes not. When I check the variables with NSLOG they are correct (eg the same for both pictures above).
I have checked Apple's documentation and tried their example but no luck.
Where should I start troubleshooting? I'm getting crazy!!
I finally found the problem :-)
An UIPageControl that is given a value 0 for number of pages will not show correctly the next time it is updated. I was reading chapter and page numbers from an array and in the beginning (let's say cover of the book) there are no pages and no chapters to show, so I happily set these to 0. Since I did not want to change the source data in my array I used MAX(pages , 1) for numberOfPages, so now it's working like clockwork.
Are you sure your chapterCount and pageCount views are not nil? You can have valid values all day, a message to nil does nothing and returns nil. Double check your view and controller wiring/unwiring when you change chapters.
EDIT:
confirm the size of the control is big enough to hold all your pages, and the view bounds is not clipped. For example, if you had 10 pages, and the "current" page was 10, but there were only 9 dots visible, it would appear as though nothing is highlighted because the white dot would be clipped from the visible area by being outside the viewable bounds. You can adjust the size dynamically using this:
- (CGSize)sizeForNumberOfPages:(NSInteger)pageCount

jquery .attr('alt','logo').css('display','none') not working !

I have the three following lines and the first two line gets all the images on the document and hides all, but then when I add the third line shows all the images.
What I need its to hide only the images with the attribute alt=minimize and alt=maximize but for some reason hides all the images.
$('img').attr('alt', 'minimize').css("display","none");
$('img').attr('alt', 'maximize').css("display","none");
$('img').attr('alt', 'logo').css("display","inline");
I am using IE7, but it should be compatible with IE6 and IE8.
Any help would be very much appreciated.
Thanks.
I'm thinking you are not using the attr function correctly, might you be looking for the attribute equals selector?:
$('img[alt=minimize]').css("display","none");
What you did with your code was,
Select all images
Change their alt attribute to 'minimize'
Hide them
Select all images
Change their alt attribute to 'maximize'
Hide them
Select all images
Change their alt attribute to 'logo'
Hide them
what you do: you take every img in document and set alt to logo and then set display: inline;.
Note, that attr('alt',string) doesn't filter all images to those with alt=string, but rather sets alt attribute to string on all images.
What you want to use is this:
$('img[alt="minimize"]').css...
$('img[alt="maximize"]').css...
$('img[alt="logo"]').css...
In the call $('img').attr('alt', 'logo').css("display","inline"); the "attr" doesen't filter the set of dom elements You catch with $("img").
If you want to hide everithing but not the image with the attribute 'alt' = 'logo' I think You can:
give it an Id of logo and then calling: $("img").not("#logo").hide()
from the jquery website:
hide():
The matched elements will be hidden
immediately, with no animation. This
is roughly equivalent to calling
.css('display', 'none'), except that
the value of the display property is
saved in jQuery's data cache so that
display can later be restored to its
initial value. If an element has a
display value of inline, then is
hidden and shown, it will once again
be displayed inline.
and
attr( attributeName )
Returns: String
Description: Get the value of an
attribute for the first element in the
set of matched elements.
If instead you want to hide all the maximize and minimize images (both share the "imize" part of the attribute):
$(parentElement).find("img[#attr $= '*imize']").hide()
OP is referring to
http://dev.w3.org/csswg/css3-values/#attr
alt I think is simply a string type, not "logo" whatever that is, that is not a data type.
try that. in fact, you can look up alt in the html5 img
http://www.w3.org/TR/html5/the-img-element.html#the-img-element
http://www.w3.org/TR/html5/the-img-element.html#attr-img-alt
http://www.w3.org/TR/html5/the-img-element.html#alt
(in order of reference clicking, last one is the target)
even if this isn't the exact answer (it should be), it should be a step in the right direction.
I am actually trying myself to figure out how to reference a css property within css with attr() - it's mentioned within the top URL. if I had my druthers, I could be using css calc() along with it, but that's draft. maybe I can get it to work...