OfficeDev / office-js

A repo and NPM package for Office.js, corresponding to a copy of what gets published to the official "evergreen" Office.js CDN, at https://appsforoffice.microsoft.com/lib/1/hosted/office.js.
https://learn.microsoft.com/javascript/api/overview
Other
670 stars 96 forks source link

Sample Requrest about Word Web,Word Javascript API 1.7 #4430

Open qingfusheng opened 6 months ago

qingfusheng commented 6 months ago

Describe your scenario Word Web Addin,Word Javascript API Preview,Office2019,版本号2402,17328.20184

What is the problem to solve?

  1. 我想知道如何同时设置中文字体和英文字体,因为很多格式同时要求了中英文。
  2. 我想知道有没有关于 Word 中 交叉引用(Cross Reference)相关的API(I can't find it and I need the function);
  3. 有没有列表相关的示例,即涉及一二三级标题的编号问题。
ElizabethSamuel-MSFT commented 6 months ago

Thanks for asking about this. We've added this to our documentation backlog (internal item 8843657).

ElizabethSamuel-MSFT commented 6 months ago

Regarding item 2, see if fields do what you need (maybe FieldType Ref?). The actual field type likely depends on what type of reference you insert - consider trying various types in the Word UI to see what field type is set. There are restrictions with using fields (see the Remarks for Word.Range.insertField).

Regarding item 3, we have List examples showing level numbering (e.g., Word.List.setLevelNumbering). You should be able to apply this to paragraphs using heading styles.

Let us know whether or not this helped, or if you have further questions.

We still need to investigate item 1.

Thanks.

qingfusheng commented 6 months ago

Thank you very much for your response, sincerely.

  1. Regarding the second question, thank you for your explanation. I have successfully created a bookmark and used the InsertField function to insert a reference, which has been very helpful for me.

  2. As for the third question, my scenario involves adding styles for first, second, and third level headings in the Word Style pane (Home → Styles). This will involve automatic numbering of styles. However, upon examining the properties of Style and Style.ParagraphFormat, I found that the properties related to lists are read-only. The Paragraph class does have a startNewList() function, but I'm unsure if this will help with my requirement because what I need is to set numbering properties for Style.

ElizabethSamuel-MSFT commented 4 months ago

@qingfusheng For item 1, can you provide some more details about this, including one or two examples of formats that require 2 fonts at the same time? Thanks.

qingfusheng commented 4 months ago

Regarding to item1, it may be used in Chinese writing, especially when the content contains both Chinese and English, and the formats for both Chinese and English fonts are specified separately. In Word applications, applying Chinese fonts first and then English fonts may solve the problem. I want to incorporate this requirement into the style Editing, so it may be necessary to specify both Chinese and English fonts simultaneously. (Style editing in Word applications supports simultaneous editing of both Chinese and English fonts)

ElizabethSamuel-MSFT commented 4 months ago

Hi @qingfusheng Thanks for your clarification. I'm transferring this to the product repo office-js for the feature crew to take a look.

Thanks.

ElizabethSamuel-MSFT commented 4 months ago

@shanshanzheng-dev Can you take a look? Thanks.

yilin4 commented 4 months ago

@qingfusheng Hi, Word.Style(https://learn.microsoft.com/en-us/javascript/api/word/word.style?view=word-js-preview) APIs just provide to set single font. If you have this need, we would like to suggest you go to https://techcommunity.microsoft.com/t5/microsoft-365-developer-platform/idb-p/Microsoft365DeveloperPlatform to ask a new question. Feature requests on it are considered when we go through our planning process.