将图片插入Word文档时如何检索图像文件名(How to retrieve image filename when inserting pictures to Word document)
我有包含一些图片的Word文档。 添加图片的代码是:
ActiveDocument.Shapes.AddPicture Anchor:= Selection.Range, fileName:=localFileName, LinkToFile:=True, SaveWithDocument:=True
无论如何回到那张图片并阅读文件名变量? 我可以通过ActiveDocument的Shapes集合并检查图片,但是我没有看到会暴露localFileName的属性。
I have Word documents that contain some pictures. The code to add the pictures is:
ActiveDocument.Shapes.AddPicture Anchor:= Selection.Range, fileName:=localFileName, LinkToFile:=True, SaveWithDocument:=True
Is there anyway to come back to that picture and read the filename variable? I can go through the Shapes collection of the ActiveDocument and check for pictures, but I don't see a property that would expose the localFileName.
原文:https://stackoverflow.com/questions/42302599
最满意答案
我终于弄清楚问题对我来说是什么。 我正在使用viewController的 - (void)willLayoutSubviews方法来确保我有正确的边界,但我忘了看我的SKScene是否已经呈现。 这导致每次将视图放在旧视图之上时,会出现一个新的welcomeScene。
-(void)willLayoutSubviews { if(!self.didPresentScene) { // Present scene here .... self.didPresentScene = YES; } }
I finally figured out what the problem was for me. I was using the -(void)willLayoutSubviews method of the viewController to ensure I had the correct bounds, but I had forgotten to see if my SKScene was already presented. That resulted in a new welcomeScene being presented each time the view was laid out on top of the old one.
-(void)willLayoutSubviews { if(!self.didPresentScene) { // Present scene here .... self.didPresentScene = YES; } }
相关问答
更多-
好的,你可以相当容易地做到这一点。 它基本上就像你用框架做的那样。 首先,您需要创建“变量”约束并将其保存到属性中。 你可以用代码做到这一点...... self.heightConstraint = [NSLayoutConstraint constraintWithItem:self.theView attribute: relatedBy: toItem: attribute: multiplier: constant:]; // set up the rest [self.view addCons ...
-
我发现使用UIScrollView对我来说效果很好。 从SKScene您可以访问父视图; self.view。 从场景的didMoveToView:方法中,您可以添加UIScrollView并从willMoveFromView:方法中删除/隐藏它。 I have found that using a UIScrollView works well for me. From an SKScene you have access to the parent view; self.view. From the s ...
-
spritekit SKView是viewcontroller的视图。 每个子视图都将呈现在它上面。 您是否有特殊原因要将Spritekit用于操纵杆? 否则我建议用标准的UIKit元素制作它,然后在imageView之后添加它。 在其他视图之上使用SKView将无法获得所需的结果,因为它不具有透明背景。 您的代码的另一个问题:您不应该在viewWillLayoutSubviews创建和添加视图,因为可以多次调用此方法(例如,每个设备Rotation)。 请改用viewDidLoad 。 The sprit ...
-
UIScrollView无法显示(UIScrollView can't appear)[2022-02-02]
我会给你一个应该帮助你的例子 let scrollView = UIScrollView() let viewA = UIView() let viewB = UIView() let viewC = UIView() view.addSubview(scrollView) scrollView.addSubview(viewA) scrollView.addSubview(viewB) scrollView.addSubview(viewC) scroll.snp.makeConstraints { ... -
UIScrollView不滚动(UIScrollView not scrolling)[2023-08-21]
显示一个完整的工作代码片段总是很好: // in viewDidLoad (if using Autolayout check note below): UIScrollView *myScrollView; UIView *contentView; // scrollview won't scroll unless content size explicitly set [myScrollView addSubview:contentView];//if the contentView is not ... -
在iPhone上我已经通过仅使用UIKit完成了这个...而且我没有任何问题。 所以我会回答纯粹的UIKit 。 在iWatch上,我没有足够的知识来回答你这个部分。 你说你想要UIImageView ,但我不认为你想这样做。 相反,您应该将UIView子类化并私下管理UIImageView实例。 此外,当且仅当您想在应用程序中仅为该组件使用SpritKit ,您应该避免使用它,因为您拥有的依赖性越小,您就越高兴。 但这是我个人对此的想法。 On iPhone I've already done this ...
-
UIscrollview委派(UIscrollview delegation)[2023-06-23]
尝试这个: ViewController1 class ViewController1: UIViewController { let defaults = NSUserDefaults.standardUserDefaults() let switch1Key = "view1Switch" override func viewWillAppear(animated: Bool) { view1Switch.on = defaults.boolForKey(switch1Key) ... -
我终于弄清楚问题对我来说是什么。 我正在使用viewController的 - (void)willLayoutSubviews方法来确保我有正确的边界,但我忘了看我的SKScene是否已经呈现。 这导致每次将视图放在旧视图之上时,会出现一个新的welcomeScene。 -(void)willLayoutSubviews { if(!self.didPresentScene) { // Present scene here .... self ...
-
如果可能的话,我会避免使用UIKit组件。 当你有一个UIView作为UIKit组件的父级时,它很难与你在SpriteKit组件进行交互。 将SKNode子类SKNode并制作一个使用SKView上的手势识别器进行滚动的“ScrollingNode”非常容易。 这是一个例子: https://github.com/JenDobson/SpriteKitScrollingNode 另一个值得关注的好教程是http://www.raywenderlich.com/44270/sprite-kit-tutoria ...
-
UIScrollView通知(UIScrollView notifications)[2022-11-19]
-scrollViewDidEndScrollingAnimation:怎么-scrollViewDidEndScrollingAnimation: ? 如果它不起作用,请尝试侦听UITextSelectionDidScroll通知。 (当然,它没有记录。) 或者,SDK安全方法测量动画所用的时间并在-scrollRectToVisible:的调用站点发送延迟通知-scrollRectToVisible: 。 How about -scrollViewDidEndScrollingAnimation:? I ...