Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Word Online] Word Online can not insert or search '\v' #5403

Open
3 tasks
shinji-morimitsu opened this issue Feb 19, 2025 · 1 comment
Open
3 tasks

[Word Online] Word Online can not insert or search '\v' #5403

shinji-morimitsu opened this issue Feb 19, 2025 · 1 comment
Assignees
Labels
Area: Word Issue related to Word add-ins Needs: attention 👋 Waiting on Microsoft to provide feedback

Comments

@shinji-morimitsu
Copy link

shinji-morimitsu commented Feb 19, 2025

Provide required information needed to triage your issue

Your Environment

  • Platform: Office on the web
  • Host: Word
  • Office version number: ______
  • Operating System: ______
  • Browser (if using Office on the web): Edge 133.0.3065.69

Expected behavior

Word AddIn script can not insert and search '\v' (\u000b) == Vertical Tab == Shift-Enter on Word Online.

Actually, expectation is the behavior of Native Word and Word Online should be same rather than '\v' handling.
This is because Microsoft REQUIRES in its AppSource approval process that addin provide the same functionality in Word Online.

Current behavior

Word AddIn script insert '\v' as string on Word Onlnie.
Word AddIn script fails to search string that contins '\v'.

Steps to reproduce

  1. Run 'live example' on Script Lab on Word Online.

  2. Insert "abc[Shift-Enter]def" on Word Online.

  3. document.body.search('c\vd')

Link to live example(s)

$("#run").on("click", () => tryCatch(run));

async function run() {
  OfficeExtension.config.extendedErrorLogging = false;

// Note: Word Online fails to insert '\v'.
// So, if you try the case of search failure on Word Online.
// Please comment out these 2 blocks, and insert 'abc[Shift-Enter]def' manually on document, then run this script.
  await Word.run(async context => {
    context.document.changeTrackingMode = Word.ChangeTrackingMode.off;
    context.document.body.clear();
    await context.sync();
    console.log('clear document');
  });
  await Word.run(async context => {
    const paragraph = context.document.body.insertParagraph("abc\u000bdef", Word.InsertLocation.start);
    await context.sync();
    console.log('setup texts');
  });
  
  await Word.run(async context => {
    context.document.body.load('text');
    const searchResult = context.document.search("c\u000bd");
    const resultRange = searchResult.getFirstOrNullObject();
    resultRange.load('items,text');
    await context.sync();

    if (resultRange.isNullObject) {
      console.log(`not found: ${context.document.body.text}`);
    } else {
      console.log(`found!: ${resultRange.text}`);
    }
  });
}

// Default helper for invoking an action and handling errors.
async function tryCatch(callback) {
  try {
    await callback();
  } catch (error) {
    // Note: In a production add-in, you'd want to notify the user through your add-in's UI.
    console.error(error);
  }
}

Provide additional details




Context

We are providing the feature that is sort of proofreading.
So, it is important to search behavior is same on Native and Online to update document on Word Document

Useful logs

  • Console errors
  • Screenshots
  • Test file (if only happens on a particular file)

Thank you for taking the time to report an issue. Our triage team will respond to you in less than 72 hours. Normally, response time is <10 hours Monday through Friday. We do not triage on weekends.

Copy link
Contributor

Thank you for letting us know about this issue. We will take a look shortly. Thanks.

@microsoft-github-policy-service microsoft-github-policy-service bot added the Needs: attention 👋 Waiting on Microsoft to provide feedback label Feb 19, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area: Word Issue related to Word add-ins Needs: attention 👋 Waiting on Microsoft to provide feedback
Projects
None yet
Development

No branches or pull requests

2 participants