首页 \ 问答 \ 将图片插入Word文档时如何检索图像文件名(How to retrieve image filename when inserting pictures to Word document)

将图片插入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
更新时间:2022-07-30 11:07

最满意答案

我终于弄清楚问题对我来说是什么。 我正在使用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 ...
  • 我会给你一个应该帮助你的例子 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 { ...
  • 显示一个完整的工作代码片段总是很好: // 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 ...
  • 尝试这个: 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 ...
  • -scrollViewDidEndScrollingAnimation:怎么-scrollViewDidEndScrollingAnimation: ? 如果它不起作用,请尝试侦听UITextSelectionDidScroll通知。 (当然,它没有记录。) 或者,SDK安全方法测量动画所用的时间并在-scrollRectToVisible:的调用站点发送延迟通知-scrollRectToVisible: 。 How about -scrollViewDidEndScrollingAnimation:? I ...

相关文章

更多

最新问答

更多
  • 您如何使用git diff文件,并将其应用于同一存储库的副本的本地分支?(How do you take a git diff file, and apply it to a local branch that is a copy of the same repository?)
  • 将长浮点值剪切为2个小数点并复制到字符数组(Cut Long Float Value to 2 decimal points and copy to Character Array)
  • OctoberCMS侧边栏不呈现(OctoberCMS Sidebar not rendering)
  • 页面加载后对象是否有资格进行垃圾回收?(Are objects eligible for garbage collection after the page loads?)
  • codeigniter中的语言不能按预期工作(language in codeigniter doesn' t work as expected)
  • 在计算机拍照在哪里进入
  • 使用cin.get()从c ++中的输入流中丢弃不需要的字符(Using cin.get() to discard unwanted characters from the input stream in c++)
  • No for循环将在for循环中运行。(No for loop will run inside for loop. Testing for primes)
  • 单页应用程序:页面重新加载(Single Page Application: page reload)
  • 在循环中选择具有相似模式的列名称(Selecting Column Name With Similar Pattern in a Loop)
  • System.StackOverflow错误(System.StackOverflow error)
  • KnockoutJS未在嵌套模板上应用beforeRemove和afterAdd(KnockoutJS not applying beforeRemove and afterAdd on nested templates)
  • 散列包括方法和/或嵌套属性(Hash include methods and/or nested attributes)
  • android - 如何避免使用Samsung RFS文件系统延迟/冻结?(android - how to avoid lag/freezes with Samsung RFS filesystem?)
  • TensorFlow:基于索引列表创建新张量(TensorFlow: Create a new tensor based on list of indices)
  • 企业安全培训的各项内容
  • 错误:RPC失败;(error: RPC failed; curl transfer closed with outstanding read data remaining)
  • C#类名中允许哪些字符?(What characters are allowed in C# class name?)
  • NumPy:将int64值存储在np.array中并使用dtype float64并将其转换回整数是否安全?(NumPy: Is it safe to store an int64 value in an np.array with dtype float64 and later convert it back to integer?)
  • 注销后如何隐藏导航portlet?(How to hide navigation portlet after logout?)
  • 将多个行和可变行移动到列(moving multiple and variable rows to columns)
  • 提交表单时忽略基础href,而不使用Javascript(ignore base href when submitting form, without using Javascript)
  • 对setOnInfoWindowClickListener的意图(Intent on setOnInfoWindowClickListener)
  • Angular $资源不会改变方法(Angular $resource doesn't change method)
  • 在Angular 5中不是一个函数(is not a function in Angular 5)
  • 如何配置Composite C1以将.m和桌面作为同一站点提供服务(How to configure Composite C1 to serve .m and desktop as the same site)
  • 不适用:悬停在悬停时:在元素之前[复制](Don't apply :hover when hovering on :before element [duplicate])
  • 常见的python rpc和cli接口(Common python rpc and cli interface)
  • Mysql DB单个字段匹配多个其他字段(Mysql DB single field matching to multiple other fields)
  • 产品页面上的Magento Up出售对齐问题(Magento Up sell alignment issue on the products page)